300 likes | 315 Views
This week's course covers the mathematical and computational basis for representing spatial positions and relationships through coordinate systems. Topics include 3D cartesian, cylindrical, and spherical coordinates, matrix notation for transformations, scaling, rotation, translation, projection techniques, and vector cross products.
E N D
VIST 375 Foundations of Visualization Week of 10/17/16
Coordinates • A way to talk about spatial positions and relationships • The mathematical and computational basis for representing spatial relationships
Coordinate Systems • 3D • cartesian • cylindrical • spherical
Matrix Notation X’ = aX + bY as [P’] = [A][P] Y’ = cX + dY where [P’] = X’ [A] = a b [P] = X Y’ c d Y
3D Coordinates • positions • vectors • transformations • projections
Right handed or left handed? • Relationship of the three axes • Applies to 3D cartesian coordinates • Similar axes relationships apply in spherical and cylindrical coordinates y y z right left x x z
3D Transformations • Scaling, Rotation, Translation • in Matrix Notation [ X’ ] = [ X ] [ T ] or [ X’ ] = [ T ] [ X ] (preferred)
2D Scaling [ P’ ] = [ S ] [ P ] where [ S ] = Sx 0 0 Sy X’ = Sx*X Y’ = Sy*Y
3D Scaling X’ = Sx * X Y’ = Sy * Y or Z’ = Sz * Z x’ y’ z’ Sx 0 0 0 Sy 0 0 0 Sz x y z =
2D Rotation Positive rotation about origin x’ = x cos - y sin y’ = x sin + y cos
3D Rotation • About X axis • About Y axis • About Z axis • About “arbitrary” axis
3D Rotation about the X axis X’ = X Y’ = cos Y - sin Z Z’ = sin Y + cos Z or x y z 1 0 0 0 cos -sin 0 sin cos x’ y’ z’ =
3D Rotation about the Y axis X’ = cosX + sin Z Y’ = Y Z’ = -sin X + cos Z
3D Rotation about the Z axis X’ = cos X - sin Y Y’ = sin X + cos Y Z’ = Z
2D Translation X’ = X + Tx Y’ = Y + Ty • Remenber doesn’t fit the pattern • What to do?
3D Translations X’ = X + Tx Y’ = Y + Ty Z’ = Z + Tz Requires Homogeneous coordinate to put into matrix form
2D Homogeneous Translation [ P’ ] = [ T ][ P ] where [ T ] = 1 0 Tx [ P ] = X [ P’] = X’ 0 1 Ty Y Y’ 0 0 1 1 w x’ = X’/w y’ = Y’/w
3D Homogeneous Translation [ P’ ] = [ T ] [ P ] where x’ = X’/ W y’ = Y’/ W z’ = Z’/ W X’ Y’ Z’ W 1 0 0 Tx 0 1 0 Ty 0 0 1 Tz 0 0 0 1 X Y Z 1 =
Transformation Duality Transforming the point or Transforming the coordinate system?
Transformation Ordering • Order of transformations determines results • For example, translation then rotation is generally not the same as rotation then translation
Projections • Orthogonal • ignores distance from viewer • Perspective • takes viewer distance into account
Orthogonal Projection • 3D world into 2D plane • 3D environment onto 2D screen • Essentially just ignores depth or the Z coordinate
Perspective Projection • Again 3D world into 2D plane, but • Modifies projected x,y position based on distance from eye or z coordinate X x,y,z image plane x’,y’ line of sight eye Z f
Projection Transformation [ P’ ] = [ Mp ][ P ] where [ P’] = [ P ] = [ Mp ] = x’ = X’ / w y’ = Y’/ w z’ = Z’/ w x’ = x / (z / f) y’ = y / (z / f) z’ = f x’ y’ z’ w x y z 1 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1/f 0
Alternative Form X eye Z d image plane
Alternative Form [P’ ] = [Mp ][P] where [P’] = [P] = [Mp ]= x’ = X’/ w y’ = Y’/ w z’ = 0/w x’ = x/((z/d)+1) y’ = y/((z/d)+1) x’ y’ z’ w x y z 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1/d 1
Projection Matrices Orthogonal Perspective 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1/d 1
3D Vector Cross Products C = A x B where A, B, and C are all vectors C is normal to the plane of A and B Cx = AyBz-ByAz Cy = AzBx-AxBz Cz = AxBy-BxAy and |C| = |A||B| sin
Vector Cross Product Can be define as the ‘determinant’ i j k C = Ax Ay Az Bx By Bz where i, j, k are unit vectors in the x, y, z directions
Transformation Concatenation Transformations can be successively applied in matrix form as follows X’ = [ T3 ] [ T2 ] [ T1 ] [ X ] which means X’ = ( [ T3 ] ( [ T2 ] ( [ T1 ] [ X ] ) ) ) or X’ = ( ( ( [ T3 ] [ T2 ] ) [ T1 ] ) [ X ] )