Presentation on theme: "3D Transformations Assist. Prof. Dr. Ahmet Sayar"— Presentation transcript:
13D Transformations Assist. Prof. Dr. Ahmet Sayar Computer Engineering DepartmentComputer Graphics CourseKocaeli UniversityFall 2012
2Extending From 2d Approach Methods for geometric transformations in three dimensions are extended from two-dimensional methods by including considerations for the z coordinate.A three-dimensional position, expressed in homogeneous coordinates, is represented as a four-element column vector. Thus , each geometric transformation operator is now 4 by 4 matrix.
131. Rotation Around a Parallel Axis Translate the object so that the rotation axis coincides with the parallel coordinate axisPerform the specified rotation about that axisTranslate the object so that rotation axis is moved back to its originalA coordinate position P is transformed with the sequence-1
14Rotation Around a Parallel Axis Rotating the object around a line parallel to one of the axes: Translate to axis, rotate, translate back.yyyyxxxxzzzzTranslateRotateTranslate back
152. Rotation Around an Arbitrary Axis In this case, we also need rotation to align the rotation axis with a selected coordinate axis and then to bring the rotation axis back to its original orientationA rotation axis can be defined with two coordinate position, or one position and direction angles.Now we assume that the rotation axis is defined by two points, and that the direction of rotation is to be counter clockwise when looking along the axis from p2 to p1.
16Rotation Around an Arbitrary Axis Translate the object so that the rotation axis passes though the originRotate the object so that the rotation axis is aligned with one of the coordinate axesMake the specified rotationReverse the axis rotationTranslate backxz
18Rotation Around an Arbitrary Axis u is the unit vector along V:First step: Translate P1 to origin:Next step: Align u with the z axiswe need two rotations: rotate around x axis to get uonto the xz plane, rotate around y axis to get u alignedwith z axis.
19Rotation Around an Arbitrary Axis Align u with the z axis1) rotate around x axis to get u into the xz plane,2) rotate around y axis to get u aligned with the z axisyyuαxxuβzz
20No need to study Advanced Topics BACKUP SlidesNo need to study Advanced Topics
21Rotation Around an Arbitrary Axis Align u with the z axis1) rotate around x axis to get u into the xz plane,2) rotate around y axis to get u aligned with the z axisyyyuuu'ααxxxuuzβzzz
22Dot product and Cross Product v dot u = vx * ux + vy * uy + vz * uz. That equals also to |v|*|u|*cos(a) if a is the angle between v and u vectors. Dot product is zero if vectors are perpendicular. v x u is a vector that is perpendicular to both vectors you multiply. Its length is |v|*|u|*sin(a), that is an area of parallelogram built on them. If v and u are parallel then the product is the null vector.
23Rotation Around an Arbitrary Axis Align u with the z axis1) rotate around x axis to get u into the xz plane,2) rotate around y axis to get u aligned with the z axisWe need cosine and sine of α for rotationuu'αxuzzProjection of u onyz plane
24Rotation Around an Arbitrary Axis Align u with the z axis1) rotate around x axis to get u into the xz plane,2) rotate around y axis to get u aligned with the z axisuβxu''= (a,0,d)z