Arbitrary Axis Rotations with Vector Algebra CS418 Computer Graphics John C. Hart
Vector Algebra • Forget homogenous coordinates for the moment • Simple vectors, e.g. a = ( a x , a y , a z ), b = ( b x , b y , b z )
Vector Algebra • Forget homogenous coordinates for the moment • Simple vectors, e.g. a = ( a x , a y , a z ), b = ( b x , b y , b z ) 2 + a y 2 + a z 2 ) • Length: || a || = sqrt( a x • Normalizing a vector ( a /|| a ||) makes it unit length
Vector Algebra • Forget homogenous coordinates for the moment • Simple vectors, e.g. a = ( a x , a y , a z ), b = ( b x , b y , b z ) 2 + a y 2 + a z 2 ) • Length: || a || = sqrt( a x • Normalizing a vector ( a /|| a ||) makes it unit length • Dot product a ⋅ b = a x b x + a y b y + a z b z = || a || || b || cos θ a ⋅ a = || a || 2
Vector Algebra • Forget homogenous coordinates for the moment • Simple vectors, e.g. a = ( a x , a y , a z ), b = ( b x , b y , b z ) 2 + a y 2 + a z 2 ) • Length: || a || = sqrt( a x • Normalizing a vector ( a /|| a ||) makes it unit length • Dot product a ⋅ b = a x b x + a y b y + a z b z = || a || || b || cos θ a ⋅ a = || a || 2 • Cross product a × b = ( a y b z – a z b y , a z b x – a x b z , a x b y – a y b x ) || a × b || = || a || || b || sin θ
y Arbitrary Axis Rotation p’ θ p • Rotations about x, y and z axes • Rotation * rotation = rotation v • Can rotate about any axis direction x z
y Arbitrary Axis Rotation p’ θ p • Rotations about x, y and z axes • Rotation * rotation = rotation v • Can rotate about any axis direction x • Can do simply with vector algebra z – Ensure ||v|| = 1
y Arbitrary Axis Rotation p’ θ p • Rotations about x, y and z axes o • Rotation * rotation = rotation v • Can rotate about any axis direction x • Can do simply with vector algebra z – Ensure ||v|| = 1 – Let o = (p ⋅ v)v
y Arbitrary Axis Rotation p’ θ p a • Rotations about x, y and z axes o • Rotation * rotation = rotation v • Can rotate about any axis direction x • Can do simply with vector algebra z – Ensure ||v|| = 1 – Let o = (p ⋅ v)v – Let a = p – o
y Arbitrary Axis Rotation p’ θ p a • Rotations about x, y and z axes b o • Rotation * rotation = rotation v • Can rotate about any axis direction x • Can do simply with vector algebra z – Ensure ||v|| = 1 – Let o = (p ⋅ v)v – Let a = p – o – Let b = v × a, (note that ||b||=||a||)
y Arbitrary Axis Rotation p’ θ p a • Rotations about x, y and z axes b o • Rotation * rotation = rotation v • Can rotate about any axis direction x • Can do simply with vector algebra z – Ensure ||v|| = 1 – Let o = (p ⋅ v)v b – Let a = p – o p’ – Let b = v × a, (note that ||b||=||a||) θ || a ||sin θ – Then p’ = o + a cos q + b sin q p || a ||cos θ a
y Arbitrary Axis Rotation p’ θ p a • Rotations about x, y and z axes b o • Rotation * rotation = rotation v • Can rotate about any axis direction x • Can do simply with vector algebra z – Ensure ||v|| = 1 – Let o = (p ⋅ v)v b – Let a = p – o p’ – Let b = v × a, (note that ||b||=||a||) θ || a ||sin θ – Then p’ = o + a cos q + b sin q • Simple solution to rotate a single point • Difficult to generate a rotation matrix p || a ||cos θ to rotate all vertices in a meshed model a
Recommend
More recommend