I have a some point on 3d Space which lie on xy plane ,I need to rotate those point with respect to a point which acts as a center even this point stays on the same plane.
I got lots of Algorithms Online for arbitary rotaions in 3D and 2D spaces , but i was not able to rotate the points correctly in any case .
You are asking for something quite simple, so I will
explain what you need to get it done.
When you rotate vectors (a point in 3D space (x,y,z))
you rotate about the origin (0,0,0). To perform a
rotation about an arbitrary point, you need to move
your world such that the arbitrary point is at the
origin, then rotate the original vector as you would
normally about the (0,0,0) point, and then translate
the result back such that the arbitrary point is at
its original location.
So if you have point P and an arbitrary point C
about which you want to rotate P, you need an
operator (matrix) T that translates vectors, an
operator R which rotates vectors, and another
operator S which translates vectors.
T will look like this:
1 0 0 dx
0 1 0 dy
0 0 1 dz
0 0 0 1
R will look like:
r11 r12 r13 0
r21 r22 r23 0
r31 r32 r33 0
0 0 0 1
And S will look similar to T, but with negative
signs for dx dy dz. Something like that.
The order of operation is: SRT.P
dx dy and dz are simply the components of C.
Something like that. My brain is quite fried today,
so do not design an airplane before you try this
on paper first…
Thanks SG, thanks for your help, i have solved this issue long before, any ways thanks for your replies i made 2 silly mistakes,first one is when i rotate the code for this and the second one is not for not posting here when i have trigged the error…
In all the cases you mentioned, the earth rotating about itself etc… You are always specifying rotation about some “axis (vector not point)”.
Point is a “locaiton” in 3D space. To specify rotations with respect to it you have to establish an ortho normal basis at that point and then specify your rotations with respect to those ortho normal basis vectors. (You are either generating or transforming the coordinate system but not specifying rotations with respect to a point).