How to Find the New Position of Unit Vectors when 3D Coordinate System Rotates

675 Views Asked by At

Say we have the coordinate system in 3D with unit vectors at each axis (+x, -x, +y, -y, +z, -z). Next, we have a direction vector that passes through two points P1 and P2, as well as the origin. This vector rotates the 3D coordinate system to an orientation in which one of the axes (x-axis) is parallel to it (think of it like dragging the tip of one of the unit vectors to a new position in space). My goal here is to find the new position of the unit vectors after the coordinate system has been rotated. See illustration below for a clearer explanation of the problem.

Edit: Thanks to Andrei for spotting this: say that y’ and z’ can be randomly orientated by any given angle after transforming x to x’. This angle is measured from the original +y-axis

I believe a rotation matrix or quaternion is best for this type of problems; however, I'm struggling how exactly do you fit in the pieces? Really appreciate a good response

enter image description here

1

There are 1 best solutions below

0
On

I have found an answer to this; for those who have a similar problem, what I did was to construct a general 3D rotation matrix using Euler angles. You can actually determine the Euler angle based on the given vector. Multiply the unit vectors on the coordinate axes with the rotation matrix to get the transformed vectors.