1 / 55

TRANSFORMATIONS

TRANSFORMATIONS. Transformations. What is this section going to cover? Different types of Transformations Implementation of Transformations in MicroStation Constructing Transformation Matrices The Current Transform. What are Transformations ?.

aora
Download Presentation

TRANSFORMATIONS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TRANSFORMATIONS

  2. Transformations What is this section going to cover? • Different types of Transformations • Implementation of Transformations in MicroStation • Constructing Transformation Matrices • The Current Transform

  3. What are Transformations? • Analytical equations to manipulate points or elements in 3D space • Stored in matrix form • Used for generating or modifying elements, displaying dynamics, or orientating views

  4. Types of Transformations • Translation • Scaling • Rotation • Other...

  5. Types of Transformations Translation

  6. Types of Transformations Translation - Matrix Form

  7. Types of Transformations Notes on Matrix Form: • MicroStation’s convention • The fourth row in the matrix is introduced to make the matrix square • Fourth row results in 1 = 1

  8. Types of Transformations Scaling

  9. Types of Transformations Scaling - Matrix Form

  10. Types of Transformations Rotation about the Z-axis

  11. Types of Transformations Rotation about Z - Matrix Form

  12. Types of Transformations Notes on Rotation • Stored separately in MicroStation in a 3x3 matrix • We’ve seen only rotation about the Z-axis • Values in the 3x3 matrix can represent angles about all three axi • Usually only need to deal with rotation about the Z-axis when constructing matrices

  13. Types of Transformations Mirroring

  14. Types of Transformations Shearing

  15. Types of Transformations Matrix Summary • Visualize an element transformation as the result of all points on the element being manipulated by the transformation matrix • Composite transformations will be discussed later...

  16. MDL Transformation Matrices How MicroStation stores Matrices • Transform union holds a 3 x 4 matrix for 3D files or a 2 x 3 matrix for 2D files • RotMatrix union holds a 3 x 3 matrix for 3D files or a 2 x 2 matrix for a 2D files • MDL functions will access the appropriate matrix in the union

  17. MDL Transformation Matrices • Transform matrix can have all elements of translation, scaling, and rotation • Represents a complete transformation in 3D space • RotMatrix can hold both rotation and scaling • A rotation matrix consisting of pure rotation is an orthogonal matrix

  18. MDL Transformation Matrices What is an orthogonal matrix? • By definition, a matrix is orthogonal if its transpose is equal to its inverse • Thus, the transpose of the matrix multiplied by the original matrix will equal the identity matrix

  19. MDL Transformation Matrices What is the identity matrix? • a square matrix consisting of zeros with unity along the diagonal • represents no change to points or elements manipulated by it

  20. MDL Transformation Matrices Proof:

  21. MDL Transformation Matrices Benefits of an orthogonal matrix • Points that are transformed by an orthogonal matrix can be returned to their original state by transforming the resulting points by the transpose of the original matrix • Transposition is not computationally intensive compared to full matrix inversion

  22. MDL Transformation Matrices Orthogonal rotation matrices • Stored with cells, arcs, text, etc. representing 3D rotation from an unrotated definition • Elements can be rotated back to their unrotated orientation by applying the transpose of the element’s rotation matrix

  23. MDL Transformation Matrices View rotation matrices • MicroStation also stores a RotMatrix on each view defining its orientation or viewing plane • Design file elements are transformed by the view rotation matrix for display on screen • mdlRMatrix_fromView

  24. MDL Transformation Matrices View rotation matrix • Represents a rotation from the World coordinate system to the View coordinate system • An element flat to a view will obtain a plan view orientation when physically transformed by the view’s rotation matrix • The transpose of the view rotation matrix is required to physically rotate elements from a world orientation to the view

  25. MDL Transformation Matrices Standard view rotation matrices

  26. MDL Functions • Functions are available to construct matrices and manipulate points or elements • Operate on RotMatrix, Transform, MSElement, and MSElementDesr • Of the form mdlRMatrix_… and mdlTMatrix_…

  27. MDL Functions • mdlRMatrix_getIdentity • mdlRMatrix_invert • mdlRMatrix_getinverse • mdlRMatrix_normalize

  28. MDL Functions • mdlRMatrix_fromView • mdlRMatrix_from3Points • mdlRMatrix_fromAngle • mdlRMatrix_rotate

  29. MDL Functions • mdlRMatrix_rotatePoint • mdlRMatrix_rotatePointArray • mdlRMatrix_unrotatePoint • mdlRMatrix_unrotatePointArray

  30. MDL Functions • mdlRMatrix_fromTMatrix • mdlTMatrix_fromRMatrix

  31. MDL Functions • mdlTMatrix_getIdentity • mdlTMatrix_setTranslation • mdlTMatrix_scale • mdlTMatrix_rotateByAngles

  32. MDL Functions • mdlTMatrix_transformPoint • mdlTMatrix_transformPointArray • mdlTMatrix_rotateScalePoint

  33. MDL Functions • mdlTMatrix_referenceToMaster • mdlTMatrix_masterToReference

  34. MDL Functions • mdlElement_transform • mdlElmdscr_transform

  35. Multiple Transformations • A complete element transformation may require scaling, rotation, and translation • Rotation and scaling is usually relative to a fixed point on the element • This would require translation of the element so that the fixed point resides at 0,0,0

  36. Multiple Transformations EXAMPLE: Rotating a cell about its origin

  37. Multiple Transformations STEP 1:Translation to the global origin

  38. Multiple Transformations: STEP 2: Rotation about the global origin

  39. Multiple Transformations STEP 3: Translation back to point in space

  40. Multiple Transformations Transformations can be applied in succession.. mdlTMatrix_getIdentity(&tMatrix); mdlTMatrix_setTranslation(&tMatrix, &transTo); mdlElmdscr_transform(edP, &tMatrix); mdlTMatrix_getIdentity(&tMatrix); mdlTMatrix_rotateByAngles(&tMatrix, &tMatrix, fc_zero, fc_zero, angle_rad); mdlElmdscr_transform(edP, &tMatrix); mdlTMatrix_getIdentity(&tMatrix); mdlTMatrix_setTranslation(&tMatrix, &transBack); mdlElmdscr_transform(edP, &tMatrix);

  41. Multiple Transformations …or concatenated into a composite matrix • There exists a single matrix representing a complete transformation • Multiplying the individual matrices will result in the composite matrix

  42. Multiple Transformations EXAMPLE: Order of Transformations

  43. Multiple Transformations MicroStation’s matrix convention requires the matrices to be multiplied in reverse order

  44. Multiple Transformations • Matrix multiplication is associative but not commutative • Any two adjacent matrices can be multiplied together • Must adhere to reverse order of multiplication

  45. Multiple Transformations EXAMPLE: The Composite Transformation Matrix

  46. Composite Transformations • MDL functions accepting an input matrix usually construct a composite transformation matrix • Passing NULL will initialize the input matrix to the identity matrix • But difficult to predict the order in which matrices are multiplied

  47. Composite Transformations Can explicitly multiply individual matrices... • mdlRMatrix_multiply • mdlTMatrix_multiply

  48. Composite Transformations EXAMPLE: Explicit Matrix Multiplication mdlTMatrix_translate(&tMatrixTo, NULL, -origin.x, -origin.y, -origin.z) mdlTMatrix_rotateByAngles(&tMatixRot, NULL, fc_zero, fc_zero, angle_rad) mdlTMatrix_translate(&tMatrixBack, NULL, origin.x, origin.y, origin.z) mdlTMatrix_multiply(&tMatrixTmp, &tMatrixBack, &tMatrixRot) mdlTMatrix_multiply(&tMatrix, &tMatrixTmp, &tMatrixTo) mdlElmdscr_transform(edP, &tMatix)

  49. Composite Transformations …or use the functions that accept an input matrix mdlTMatrix_rotateByAngles(&tMatrix, NULL, fc_zero, fc_zero, angle_rad); mdlTMatrix_setOrigin (&tMatrix, &origin); mdlElmdscr_transform (edP, &tMatrix);

  50. Transformations Summary • In constructing transformation matrices first list the required individual transformations • Adhere to the rules of matrix multiplication and convention • Implement MDL functions conveniently

More Related