By representing an orientation (or rotation) by a complex number instead of an explicit angle we can drop a fair number of expensive operations. So instead of storing angle 'a', we store complex number (cos(a), sin(a)).
Another potential advantage is the algebra framework (just manipulating algebra) and reasoning. Algebra's like complex number, vectors, quaternions, etc allow thinking in terms of relative information which can greatly simplify the process.
We will assume that standard mathematical convention of the X axis pointing the to right and the Y axis pointing up. Additionally we will assume that the reference orientation of objects is pointing straight right. Combining these together when thinking about some specific entity, we can think in terms of its center being at the origin and its facing straight down the X axis.
NOTE: Although angles are talked about, this is for understanding and thinking purposes and not computation.
Common definitionsCapital letter are complex number and small are scalars.
X=(a,b)
Y=(c,d)
P=(x,y)
R=(cos(a), sin(a))
S=(cos(b), sin(b))
Addition/Subtraction
X+Y = (a,b)+(c,d) = (a+c,b+d)
X-Y = (a,b)-(c,d) = (a-c,b-d)Component-wise, can represent translation.
Magnitude (L2 norm)|X| = |(a,b)| = sqrt(a2+b2)Notice that we're not calling this length. Complex numbers, vectors, etc do not have lengths (nor positions). What they represent in a give instance might have a length equal to its magnitude.
Unit complex and trig formUnit complex numbers have a magnitude of one and can be written in 'trig form':
(cos(t),sin(t)).
Since scale factors can be pulled out (see scalar product) all complex numbers can also be written in 'trig form':
m(cos(t),sin(t)).
ConjugateX* = (a,b)* = (a,-b)R* = (cos(a),sin(a))* = (cos(a),-sin(a)) = (cos(-a),sin(-a))
So the conjugate reflects about the X axis, which is the same as negating the angular information.
Product
XY = (a,b)(c,d)
= (ac-bd, ad+bc)
RP = (cos(a), sin(a))(x,y)
= (x cos(a) - y sin(a), y cos(a) + x sin(a))
RS = (cos(a), sin(a))(cos(b), sin(b))
= (cos(a)cos(b) - sin(a)sin(b), cos(b)sin(a) + cos(a)sin(b))
= (cos(a+b), sin(a+b))So the product sums the angular information of the two inputs.
Product combined with conjugate
X*Y = (a,b)*(c,d) = (a,-b)(c,d) = (ac+bd, ad-bc)
R*S = (cos(a),sin(a))*(cos(b),sin(b))
= (cos(-a),sin(-a))(cos(b),sin(b))
= (cos(a)cos(b)+sin(a)sin(b), -cos(b)sin(a)+cos(a)sin(b))
= (cos(b-a),sin(b-a))Since we can add angles with the product and can negate an angle with the conjugate, the two together allow us to subtract angles. (AKA get relative angular information)
Scalar productsX = s(a,b) = (s,0)(a,b) = (sa, sb)This can be reversed, so all scale factors can be pulled out.
Counterclockwise rotation of point about the originFalls directly out of the product. Given rotation (R) and point (P), the point after rotation (P'):
P' = RP
= (cos(a), sin(a))(x,y)
= (x cos(a) - y sin(a), y cos(a) + x sin(a))Example:
P = (3,3)
R = (cos(pi/4), sin(pi/4)) = (.707107, .707107)
P' = (3,3)*(.707107, .707107)
= (0, 4.24264)How do I find rotation of A into BSolve the above. Assuming A & B are unit vectors:
RA = B
R = B(1/A)
R = BA*Example:
A = (0.809017, 0.587785)
B = (0.5, -0.866025)
R = BA*
= (0.5, -0.866025)(0.809017, 0.587785)*
= (0.5, -0.866025)(0.809017, -0.587785)
= (-0.104528, -0.994522)Counterclockwise rotation of point about arbitrary pointWe can rotate about the origin, to rotate about an arbitrary point (C) translate the system to the origin, perform the rotation and then undo the translation.
P' = R(P-C)+C
= RP-RC+C
= RP+C-RC
= RP+C(1-R)
= RP+Twhere
T = C(1-R). Look at the last line. It is telling you that the rotation R about point C is equivalent to a rotation about the origin R followed by a translation T. And C is recoverable from T & R:
C = T/(1-R) (assuming R isn't 1...or no rotation).
Relation to dot and cross productsFalls directly from the product where one is conjugated:
X*Y = (a,b)*(c,d) = (a,-b)(c,d) = (ac+bd, ad-bc)dot(X,Y) = ac+bdcross(X,Y) = ad-bcThe dot product is the parallel projection and the cross is the orthogonal projection. From the complex numbers perspective consider the
R*S computation above combined with rotation.
XXX
This wiki entry has had 4 revisions with contributions from 1 members.
(
more info)