How can I rotate a 3D point about y-axis respect to the point C=(Cx, Cy, Cz)?

542 views Asked by At

For example, let's say I have P0 = (x, y, z) and I want to rotate it about y-axis with respect to the point C = (Cx, Cy, Cz)

I know that the rotation matrix to apply is:

{ {cos(angle),0,sin(angle),0}, {0,1,0,0}, {-sin(angle),0,cos(angle),0}, {0,0,0,1} }

But this matrix would be used in case of rotating with respect to (0,0,0), right?

How can I do it respect to a different point?

1

There are 1 answers

2
Lucius On BEST ANSWER

P' = (P - C) * A + C

where P is your point, C the point that should be the origin and A the transformation matrix.