



















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















































CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005
We have two non-intersecting 3D lines in space (^) Line 1 is defined by a point p 1 on the line and a ray r 1 in the direction of the line, and line 2 is defined by p 2 and r 2 Find the closest distance between the two lines p 1 p 2 r 1 r 2
(^) Notice that the sign of the result might be positive or negative depending on the geometric configuration, so we should really take the absolute value if we want a positive distance (^) Also note that the equation could fail if | r 1 x r 2 |=0, implying that the lines are parallel. We should really test for this situation and use a different equation if the lines are parallel ( ) ( ) 1 2 2 1 1 2
v ′= M ⋅ v + d
3 2 1 3 3 3 2 2 2 1 1 1 3 3 3 3 2 2 2 2 1 1 1 1 d d d v v v a b c a b c a b c v v v v a v b v c v d v a v b v c v d v a v b v c v d z y x z y x z x y z y x y z x x y z
31 32 33 21 22 23 11 12 13 31 32 33 21 22 23 11 12 13 31 32 33 21 22 23 11 12 13
12 11 12 12 22 13 32
We can combine a sequence of rotations and scales into a single matrix For example, we can combine a y-rotation, followed by a z-rotation, then a non-uniform scale, and finally an x-rotation:
x z y
3 3 3 3 2 2 2 2 1 1 1 1 3 3 3 3 2 2 2 2 1 1 1 1 = + + +
x y z z x y z y x y z x x y z z y x z y x v v v v a v b v c v d v a v b v c v d v a v b v c v d v v v a b c d a b c d a b c d v v v v M v
For example, a translation by vector r followed by a z -axis rotation can be represented as:
sin cos 0 0 cos sin 0 0 1 z y x z y x z y x v v v r r r v v v θ θ θ θ
− = 0 0 0 1 sin 0 cos 0 0 1 0 0 cos 0 sin 0 θ θ θ θ θ y R
− = 0 0 0 1 0 sin cos 0 0 cos sin 0 1 0 0 0 θ θ θ θ θ x
− = 0 0 0 1 0 0 1 0 sin cos 0 0 cos sin 0 0 θ θ θ θ θ z R
Euler’s Theorem: Any two independent orthonormal coordinate frames can be related by a sequence of rotations (not more than three) about coordinate axes, where no two successive rotations may be about the same axis. (^) Not to be confused with Euler angles, Euler integration, Newton-Euler dynamics, inviscid Euler equations, Euler characteristic… (^) Leonard Euler (1707-1783)
There are two useful ways of looking at Euler’s theorem in relationship to orientations:
(^) One method for storing an orientation is to simply store it as a sequence of rotations about principle axes, such as x, then y, then z. We refer to this as Euler angles. This is a compact method, as it uses exactly 3 numbers to store the orientation (^) Another option is to represent the orientation as a unit length axis and a scalar rotation angle, thus using 4 numbers in total. This is a conceptually straightforward method, but is of limited mathematical use, and so is not terribly common (^) A third option is to use a 3x3 matrix to represent orientation (or the upper 3x3 portion of a 4x4 matrix). This method uses 9 numbers, and so must contain some extra information (namely, the scaling and shearing info) (^) A fourth option is to use a quaternion, which is a special type of 4- dimensional vector. This is a popular and mathematically powerful method, but a little bit strange… These are covered in Math155B and CSE (^) No matter which method is used to store the orientation information, we usually need to turn it into a matrix in order to actually transform points or do other useful things
(^) The uniform scaling matrix scales an entire object by scale factor s (^) The non-uniform scaling matrix scales independently along the x , y , and z axes
= 0 0 0 1 0 0 0 0 0 0 0 0 0 s s s s u S
= 0 0 0 1 0 0 0 0 0 0 0 0 0 z y x n s s s S s