- Linear Algebra Review
- Vector Spaces
- Coordinate Transformations
- Euler Angles
- Quaternions
Coordinate System
Thumb is x, Index finger is y, middle finger is z
left handed
unity
right handed
unreal
px,py,pz
- Column vector, dim=n*1
- Row vector, dim=1*n
Unit Vectors:
(i^,j^,k^)
(u^x,u^y,u^z)
Vector magnitude (length)
∣∣pˉ∣∣=px2+py2+pz2=(pTp)21
Matrix transpose
pˉ⋅rˉ=∥p∥∥r∥cosθ
angel between 2 vec
θ=cos−1(∥ϕˉ∥∥rˉ∥ϕˉ⋅rˉ)
Projection
u^=∣∣uˉ∣∣uˉ
p⋅∥u∥u=∣∣p∣∣cosθu^
p=q×r
q×r=∥q∥∥r∥sinθn^
Where n^ is 右手法则测出来的方向,食指是q,中指是r=》拇指是n
i^×j^=k^j^×k^=i^k^×i^=j^
cross product equivalent matrix
[a]×=0az−ay−az0axay−ax0
Given v,t, v -> t
Frames of Reference 参考系
Rotation of coordinate system about the x-axis by angle, is counterclockwise
v1 in Frame 1 to the Frame 0
pˉ=px1i^1+py1j^1+pz1k^1
pˉ0=R10pˉ1
Rotation Matrix: R10
R10=[i^1∣j^1∣k^1]
R01R10=I
$R_10=(R_01)T=(R_01)^{-1}\Rightarrow $ Orthonormal Matrix
R10(x,ϕ)=RX=1000cosϕsinϕ0−sinϕcosϕ
绕 ( y ) 轴旋转 ( θ ) 角度的旋转矩阵可以表示为:
R(y,θ)=RY=cosθ0−sinθ010sinθ0cosθ
将点 ((x, y, z)) 旋转到新的位置 ((x', y', z')) ,其中 ( \theta ) 是绕 ( y ) 轴的旋转角度。
R(z,ψ)=RZ=cosψsinψ0−sinψcosψ0001
roll, pitch, yaw
Phi, theta, Psi
Order of 3 rotations about local axis
y -> z -> x
z->y->x
RE=Rzyx(ϕ,θ,ψ)=RZRYRX
RE=RZYX(ϕ,θ,ψ)=Rz(ψ)RY(θ)RX(ϕ)=cosψsinψ0−sinψcosψ0001cosθ0−sinθ010sinθ0cosθ1000cosϕsinϕ0−sinϕcosϕ=cosθcosψcosθsinψ−sinθsinϕsinθcosψ−cosϕsinψsinϕsinθsinψ+cosϕcosψcosθsinϕsinϕsinψ+cosϕsinθcosψsinψsinθcosϕ−cosψsinϕcosθcosϕ
??
Order of 3 rotations about world axis
x->y->z
Rzyx=RzRyRx
translation vector: d10
p0=p1+d10
Scale matrix: S
S=Sx000Sy000Sz
p0=R10p1+d10
(p01)=(R100d101)(p11)=H10(p11)
Hrot=Hrotate=(R001)Hrot(axis,angle)=(Raxis(angle)001)Htrans=(I0d1)Hscale=(S001)
- transformation w.r.t. local axes => post multiply
- transformation w.r.t. world axes => pres multiply
H1H2=(R1R20R1d2+d11)
H−1Hrot−1Htrans−1=(RT0−RTd1)=(RT001)=(I0−d1)
Product of inverse => reverse order of individual inverse
H=H1H2H3H−1=(H1H2H3)−1=H3−1H2−1H1−1
Frame of Reference: F
Global (World) Frame: F0=I
rotated frame to unrotated frame
p0=R10p1
Rotation matrix transform vectors from the rotated frame to the unrotated(F0)
Local to global
p0=R10p1
body to world
p0=R10p1
child to parent
F1=F10=H1F0
p0=F30p3
sequences of transforms => order of
- post-multiply=>local axis
- pre-multiply=>global axis
H=H3(H1H2)H4
Example questions:
Given p0, compute p3:
p0=F30p3⇒p3=(F30)−1p0
Given F1, F2, compute H12:
F20=HF10⇒H=F20(F10)−1F20=F10H⇒H=(F10)−1F20
Converting form left handed to right handed Coord System
Position:
Left-handed coordinates:Right-handed coordinates:Conversion:(xL,yL,zL)(xR,yR,zR)⎩⎨⎧xR=xLyR=yLzR=−zL
Euler Angles:
[ϕL,θL,ψL][−ϕR,−θR,ψR]
Axis: u^, Angle: θ
q=(sv)=(wv)=(cos2θsin2θu)=svxvyvz=wxyz
Problems of Euler Angles representing rotations
axes colinear => "Gimbal lock"

Gimbal locked airplane.
When the pitch (green) and yaw (magenta) gimbals become aligned, changes to roll (blue) and yaw apply the same rotation to the airplane.
Add: q1+q2=[s1+s2,v1+v2]T
Mul: q1⋅q2=[s1s2−v1v2,s1v2+s2v1+v1×c2]T
if Δq w.r.t world:
q2=Δq⋅q1=q1,20q1
if Δq w.r.t local
q2=q1⋅Δq=q1⋅q1,21
Mag: ∣∣q∣∣=w2+x2+y2+z2=1
Inv: q−1=(∣∣q∣∣1)2[s,−v]T=[s,−v]T
几何意义,角度不变,轴取反
prot=q⋅p⋅q−1
Rotate axis by quaternion q
Post dot product
Rotate axis by angle (of q)
q2=Δq⋅q1=q12q1
Given vector v1, v2
Angle: dot prodcut, law of cosine
θ=arccos∥v1∥∥v2∥v1⋅v2
Axis: cross product
u^=∥u∥u=∥v1∥∥v2∥v1×v2
Quiz
- Rotation Matrix
- Eular Angles
- Quaternions
i^rot=1−2y2−2z22xy+2wz2xz−2wyj^rot=2xy−2wz1−2x2−2z22yz+2wxk^rot=2xz+2wy2yz−2wx1−2x2−2y2R=[i^∣j^∣k^]
w=21+r11+r22+r33x=21+r11−2w2=4wr32−r23y=21+r22−2w2=4wr13−r31z=21+r33−2w2=4wr21−r12
qxyz=qxqyqzqx=[cos2ϕ,sin2ϕu^]T=[cos2ϕ,sin2ϕ(1,0,0)]Tqy=[cos2θ,sin2θu^]T=[cos2ϕ,sin2ϕ(0,1,0)]Tqz=[cos2ψ,sin2ψu^]T=[cos2ϕ,sin2ϕ(0,0,1)]T
ϕy=−arcsinr31ϕx=arctanr33r32ϕz=arctanr11r21
related to sequence, detail see reference
RZYX=RZRYRX