Modeling Transformation

download Modeling Transformation

of 42

  • date post

    12-Jan-2016
  • Category

    Documents

  • view

    25
  • download

    0

Embed Size (px)

description

Modeling Transformation. Overview. 2D Transformation Basic 2D transformations Matrix representation Matrix Composition 3D Transformation Basic 3D transformations Same as 2D Transformation Hierarchies Scene graphs Ray casting. Modeling Transformation. - PowerPoint PPT Presentation

Transcript of Modeling Transformation

  • Modeling Transformation

  • Overview2D TransformationBasic 2D transformationsMatrix representationMatrix Composition3D TransformationBasic 3D transformationsSame as 2DTransformation HierarchiesScene graphsRay casting

  • Modeling TransformationSpecify transformations for objectsAllow definitions of objects in own coordinate systemsAllow use of object definition multiple times in a sceneRef] Hearn & Baker

  • 2D Modeling Transformations

  • 2D Modeling Transformations

  • Basic 2D TransformationsTranslationx = x + txy = y + tyScalex = x * sxy = y * syShearx = x + hx * yy = y + hy * xRotationx = x * cosq - y * sinqy = x * sinq + y * cosq

  • Matrix RepresentationRepresent 2D transformation by a matrix

    Multiply matrix by column vectorApply transformation to point

  • Matrix RepresentationTransformations combined by multiplication

    Matrices are a convenient and efficient way to represent a sequence of transformations

  • 2 x 2 MatricesWhat types of transformations can be represented with a 2 x 2 matrix?2D Identity

    2D Scale around (0, 0)

  • 2 x 2 MatricesWhat types of transformations can be represented with a 2x 2 matrix?2D Rotate around (0, 0)

    2D Shear shx = 2

  • 2 x 2 MatricesWhat types of transformations can be represented with a 2x 2 matrix?2D Mirror (=Reflection) over Y axis

    2D Mirror over (0, 0)

  • 2 x 2 MatricesWhat types of transformations can be represented with a 2x 2 matrix?2D Translation ?

    NO!Only linear 2D transformation can be presented with a 2 x 2 matrix

  • Linear TransformationsLinear transformations are combinations of ScaleRotationShearMirror (=Reflection)Properties of linear transformationsSatisfies: Origin maps to originLines map to linesParallel line remain parallelRatios are preservedClosed under composition

  • 2D Translation2D Translation represented by a 3 x 3 matrixPoint represented with homogeneous coordinate

  • Homogeneous CoordinatesAdd a 3rd coordinate to every 2D point(x, y, w) represents a point at location (x/w, y/w)(x, y, 0) represents a point at infinity(0, 0, 0) is not allowed

  • Basic 2D TransformationsBasic 2D Transformations as 3 x 3 matrices

  • Affine TransformationsAffine Transformations are combinations of Linear transformationTranslation

    Properties of affine transformationsOrigin does not necessarily map to originLines map to linesParallel line remain parallelRatios are preservedClosed under composition

  • Transformation : Rigid-Body / Euclidean Transforms Rigid Body Transformation (=rigid motion) A transform made up of only translation and rotationPreserve the shape of the objects that they act on Preserves distancesPreserves anglesTranslationRotationRigid / EuclideanIdentity

  • Transformation : Similitudes / Similarity TransformsSimilarity TransformationsPreserves anglesTranslation, Rotation, Isotropic scaling TranslationRotationRigid / EuclideanSimilitudesIsotropic ScalingIdentity

  • Transformation : Linear TransformationsTranslationRotationRigid / EuclideanLinearSimilitudesIsotropic ScalingIdentityScalingShearReflectionTranslation is not linear

  • Transformation : Affine Transformationspreserves parallel linesTranslationRotationRigid / EuclideanLinearSimilitudesIsotropic ScalingScalingShearReflectionIdentityAffine

  • Transformation : Projective Transformationspreserves linesTranslationRotationRigid / EuclideanLinearAffineProjectiveSimilitudesIsotropic ScalingScalingShearReflectionPerspectiveIdentity

  • Projective TransformationsProjective Transformations Affine transformationProjective warps

    Properties of projective transformationsOrigin does not necessarily map to originLines map to linesParallel line do not necessarily remain parallelRatios are not preserved (but cross-ratios are)Closed under composition

  • Cross-ratioGiven any four points A, B, C, and D, taken in order, define their cross ratio as

    Cross Ratio (ABCD) =cross ratio (ABCD) = cross ratio (A'B'C'D')

  • Matrix CompositionTransformations can be combined by matrix multiplication

  • Matrix CompositionMatrices are a convenient and efficient way to represent a sequence of transformationsGeneral purpose representationsHardware matrix multiplyEfficiency with premultiplication

  • Matrix CompositionBe aware: order of transformations matterMatrix multiplication is not commutativeGlobalLocal

  • Non-commutative CompositionScale then Translate: p' = T ( S p ) = TS pTranslate then Scale: p' = S ( T p ) = ST p(0,0)(1,1)(4,2)(3,1)(8,4)(6,2)(0,0)(1,1)(2,2)(0,0)(5,3)(3,1)Scale(2,2)Translate(3,1)Translate(3,1)Scale(2,2)

  • Matrix CompositionRotate by q around arbitrary point (a, b)M = T(a, b)* R(q) * T(-a, -b)Translate (a, b) to the origindo the rotation about origintranslate back

    Scale by sx, sy around arbitrary point (a, b)M = T(a, b)* S(sx, sy) * T(-a, -b)Translate (a, b) to the origindo the scale about origintranslate back

  • Transformation Game

  • Overview2D TransformationBasic 2D transformationsMatrix representationMatrix Composition3D TransformationBasic 3D transformationsSame as 2DTransformation HierarchiesScene graphsRay casting

  • 3D TransformationsSame idea as 2D transformationsHomogeneous coordinates: (x, y, z, w)4 x 4 transformation matrices

  • Basic 3D transformations

  • Basic 3D transformations

  • Non-commutative Composition : Order of RotationsOrder of Rotation Affects Final PositionX-axis Z-axis

    Z-axis X-axis

  • Matrix Composition : Rotations in spaceRotation about an Arbitrary AxisRotate about some arbitrary a through angle Rotate about the z axis through an angle The axis a lies in the yz planeRotate about the x axis through an angle The axis a coincident with the z axisRotate about the a axis through Same as a rotation about the now coincident z axisReverse the second rotation about the x axisReverse the first rotation about the z axisReturning the axis a to its original position

    yzxa

  • Transformation HierarchiesScene may have hierarchy of coordinate systemsEach level stores matrix representing transformation from parents coordinate system

  • Transformation Example 1 Well-suited for humanoid characters

  • Transformation Example 1Ref] Princeton University

  • Transformation Example 2An object may appear in a scene multiple times

  • Transformation Example 2

  • SummaryCoordinate systemsWorld coordinatesModeling coordinatesRepresentations of 3D modeling transformations4 x 4 MatricesScale, rotate, translate, shear, projections, etc.Not arbitrary warpsComposition of 3D transformationsMatrix multiplication (order matters)Transformation hierarchies