<p><a href="https://en.wikipedia.org/wiki/Rotation_matrix" rel="nofollow noreferrer">Rotation matrix | wikipedia.org</a> in section that says "in three dimensions". It's the first search result when searching about rotating a vector about an axis. Let me know if you have any questions.</p>

<p>For your specific problem: bring the point P to the origin, then rotate the vector about the Z axis, then bring the point P back to its original location.</p>

CC BY-SA 4.0
2018-08-24T13:40:34.333Z
2018-10-14T18:31:15.790Z
2018-10-14T18:31:15.790Z
Kyy13
<p>One other solution is to identify the vector's endpoint with respect to the point P. Then, rotate the endpoint as desired and recompute the new vector based on the rotated endpoint and the point P.</p>

CC BY-SA 4.0
2018-10-12T19:14:00.353Z
2018-10-12T19:14:00.353Z
Ebram
<p>Thank you for the suggestions provided. As @gallickgunner mentioned, I shall rephrase the question will all the possible information which I could provide. I had attached also the schematic to depict my question.</p>
<p>1)I need to rotate the vector V with the base point P by an angle and find the new vector V'.
2) The rotation axis is say for is about a local y axis at point P (which is parallel to global Y axis)
3) Subsequently, I need to rotate the initial vector V about x axis which is parallel to global Y axis.
The main reason for the rotation is to find the new vector V' at point P. Both the rotations are independent and each of the rotation provides a new V'.
<a href="https://i.sstatic.net/MTiJX.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MTiJX.jpg" alt="enter image description here" /></a></p>
<p>Thank you for the support. Looking forward for an answer at the earliest.</p>

CC BY-SA 4.0
2018-08-27T06:33:32.473Z
2018-08-27T06:33:32.473Z
2020-06-18T08:32:12.800Z
Raghav
<p>I have a scenario where I need rotate a vector ( unit vector) at a point in space by an angle along Z-axis. Is it possible to help me to understand a procedure to achieve this. I'm using vb.net programming to do this programattically. </p>

<p>Here is the schematics for your understanding:</p>

<p><a href="https://i.sstatic.net/HvCwq.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HvCwq.jpg" alt="enter image description here"></a></p>

CC BY-SA 4.0
2018-08-17T14:04:15.927Z
angle along Z axis doesn't clarify plus you pictures don't even have labels for Axes. What is clarified is that you don't want to rotate around Z but along Z. Then there are only 2 options left either you want to rotate around X or Y. What do you want to do?
gallickgunner
CC BY-SA 4.0
2018-08-19T13:38:41.090Z
Sorry for not adding the coordinates. I wish to transform the point P(x,y,z) to origin O(0,0,0) without varying the vector V(i,j,k) orientation. I then want to rotate along the vertical axis (Z) by an angle and move back to point P which would form Vector V'(i',j',k'). (This is based on many examples in internet). Kindly let me know if you need any further information for your suggestion a solution. If possible please provide a code snippet. Thank you
Raghav
CC BY-SA 4.0
2018-08-19T14:10:31.923Z
let me phrase differently. Suppose the random vector is `(1,0,0)` which  is your X-axis (assume front one). In this case, rotating along Z-axis (vertical axis) means you rotate the vector around Y-axis (right one). In another case let's say the vector is (0,1,0). Now rotating along Z means you rotate around X-axis. What exactly do you want in both cases? What happens when the vector is random?
gallickgunner
CC BY-SA 4.0
2018-08-19T21:39:55.240Z
As far as I am aware "rotate along" has no meaning. Could you clarify what you want (and perhaps why), preferably with specific examples? "Rotate around" the z axis would mean that the z coordinate stays fixed. "Translate in the z direction" would mean that only the z coordinate changes. Are either of those what you meant by "rotate along"?
trichoplax is on Codidact now
CC BY-SA 4.0
2018-08-22T17:10:10.080Z
I will rephrase my question:
1)I need to rotate the vector V with the base point P by an angle. 
2) The rotation axis is say for now is about a local Y axis at point P
3) The local Y axis orientation is similar to the global Y axis. 
Hope there could be some solution to this. I'm programming in VB.net for a 3D point calculation project. Kindly provide me some insight to approach this problem. Thank you.
Raghav
CC BY-SA 4.0
2018-08-26T08:19:59.523Z
@Raghav - you are giving new information bit by bit in every comment. Is there a separate global and local frame/space? Are you working with your vector in the local or the global reference frame? That alone changes a lot of things. Try editing your question and all the details and by all I mean give us the whole scenario what exactly is going on.
gallickgunner
<transformations><computational-geometry><matrix><vectors>
Rotation of a random unit vector at a point in 3D space by an angle
Raghav
# Rotation of a random unit vector at a point in 3D space by an angle

(Asked by: username_0 on 2018-08-17)

I have a scenario where I need rotate a vector ( unit vector) at a point in space by an angle along Z-axis. Is it possible to help me to understand a procedure to achieve this. I'm using vb.net programming to do this programattically.

Here is the schematics for your understanding:

[![enter image description here](https://i.sstatic.net/HvCwq.jpg)](https://i.sstatic.net/HvCwq.jpg)

**Tags:** transformations, computational-geometry, matrix, vectors

> **Comments:**
> **username_1**: angle along Z axis doesn't clarify plus you pictures don't even have labels for Axes. What is clarified is that you don't want to rotate around Z but along Z. Then there are only 2 options left either you want to rotate around X or Y. What do you want to do?  
> **username_0**: Sorry for not adding the coordinates. I wish to transform the point P(x,y,z) to origin O(0,0,0) without varying the vector V(i,j,k) orientation. I then want to rotate along the vertical axis (Z) by an angle and move back to point P which would form Vector V'(i',j',k'). (This is based on many examples in internet). Kindly let me know if you need any further information for your suggestion a solution. If possible please provide a code snippet. Thank you  
> **username_1**: let me phrase differently. Suppose the random vector is `(1,0,0)` which  is your X-axis (assume front one). In this case, rotating along Z-axis (vertical axis) means you rotate the vector around Y-axis (right one). In another case let's say the vector is (0,1,0). Now rotating along Z means you rotate around X-axis. What exactly do you want in both cases? What happens when the vector is random?  
> **username_2**: As far as I am aware "rotate along" has no meaning. Could you clarify what you want (and perhaps why), preferably with specific examples? "Rotate around" the z axis would mean that the z coordinate stays fixed. "Translate in the z direction" would mean that only the z coordinate changes. Are either of those what you meant by "rotate along"?  
> **username_0**: I will rephrase my question: 1)I need to rotate the vector V with the base point P by an angle.  2) The rotation axis is say for now is about a local Y axis at point P 3) The local Y axis orientation is similar to the global Y axis.  Hope there could be some solution to this. I'm programming in VB.net for a 3D point calculation project. Kindly provide me some insight to approach this problem. Thank you.  
> **username_1**: @username_0 - you are giving new information bit by bit in every comment. Is there a separate global and local frame/space? Are you working with your vector in the local or the global reference frame? That alone changes a lot of things. Try editing your question and all the details and by all I mean give us the whole scenario what exactly is going on.  

---

## 3 answers

### Answer by username_3 on 2018-08-24. Score: 1

[Rotation matrix | wikipedia.org](https://en.wikipedia.org/wiki/Rotation_matrix) in section that says "in three dimensions". It's the first search result when searching about rotating a vector about an axis. Let me know if you have any questions.

For your specific problem: bring the point P to the origin, then rotate the vector about the Z axis, then bring the point P back to its original location.


---

### Answer by username_4 on 2018-10-12. Score: 0

One other solution is to identify the vector's endpoint with respect to the point P. Then, rotate the endpoint as desired and recompute the new vector based on the rotated endpoint and the point P.


---

### Answer by username_0 on 2018-08-27. Score: 0

Thank you for the suggestions provided. As @username_1 mentioned, I shall rephrase the question will all the possible information which I could provide. I had attached also the schematic to depict my question.

1)I need to rotate the vector V with the base point P by an angle and find the new vector V'.
2) The rotation axis is say for is about a local y axis at point P (which is parallel to global Y axis)
3) Subsequently, I need to rotate the initial vector V about x axis which is parallel to global Y axis.
The main reason for the rotation is to find the new vector V' at point P. Both the rotations are independent and each of the rotation provides a new V'.
[![enter image description here](https://i.sstatic.net/MTiJX.jpg)](https://i.sstatic.net/MTiJX.jpg)

Thank you for the support. Looking forward for an answer at the earliest.


---

