Geometric Transformation
Total Page:16
File Type:pdf, Size:1020Kb
Geometric Transformation Prof. Janakarajan Ramkumar Professor Department of Mechanical & Design Program IIT Kanpur, India. Contents • What is Design • Coordinate systems in CAD • Transformation of geometry • Colour Models 2 Objectives • Various types of coordinate systems used in displaying CAD information • Different types of geometric transformations used during CAD geometry generation and display and their evaluation. • Learn about adding colour and shading to the display for better visualization. • Mathematics required to display a 3D image on the 2D screen of the display device. 3 What is Design? • Design, usually considered in the context of applied arts, engineering, architecture, and other creative endeavours, is used both as a noun and a verb . • As a verb, "to design" refers to the process of originating and developing a plan for a product, structure, system, or component. • As a noun, "a design" is used for both the final (solution) plan (e.g. proposal, drawing, model, description) or the result of implementing that plan (e.g. object produced, result of the process). • More recently, processes (in general) have also been treated as products of design, giving new meaning to the term "process design” 4 What is Design? Design is an Iterative Process (Ohsuga 1989) 5 Some Popular Design Approaches • User-centered design: focuses on the needs, wants, and limitations of the end user of the designed artifact. • Use-centered design: which focuses on the goals and tasks associated with the use of the artifact, rather than focusing on the end user. • KISS principle (Keep it Simple, Stupid): which strives to eliminate unnecessary complications • There is more than one way to do it (TMTOWTDI): a philosophy to allow multiple methods of doing the same thing • Murphy's Law (things will go wrong in any given situation, if you give them a chance) 6 Graphics Pipeline 7 What is CAD? Computer Aided Design (CAD) is a set of methods and tools to assist product designers in :- • Creating a geometrical representation of the artifacts they are designing • Dimensioning, Tolerancing • Configuration Management (Changes) • Archiving • Exchanging part and assembly information between teams, organizations • Feeding subsequent design steps • Analysis (CAE) • Manufacturing (CAM) 8 Major Benefits of CAD • Productivity Increase • Automation of repeated tasks • Supports Changeability • Keep track of previous design iterations • Communication enhances With other teams/engineers, e.g. manufacturing, suppliers With other applications (CAE/FEM, CAM) • Marketing, realistic product rendering • Accurate, high quality drawings • Mass Properties (Mass, Inertia) • Collisions between parts, clearances • Insert standard parts (e.g. fasteners) from database 9 Generic CAD Process 10 Coordinate systems • In a 2-D coordinate system the X axis generally points from left to right, and the Y axis generally points from bottom to top. • When we add the third coordinate, Z, we have a choice as to whether the Z-axis points into the screen or out of the screen. • The right handed Cartesian coordinate system is used for defining the geometry of the parts. Right/Left Hand Coordinate System http://n64devkit.square7.ch/kantan/step3/1/1_3.htm 11 Coordinate systems • In order to specify the geometry of a given solid, it is necessary to use a variety of coordinate systems. Its Major classifications are:- World Coordinate System:- Also known as the "universe" or sometimes "model" coordinate system. This is the base reference system for the overall model, ( generally in 3D ), to which all other model coordinates relate User Coordinate System:- Also known as “working” coordinate system. When it is difficult to define certain geometries using WCS, In such cases user coordinate system can be defined relative to the WCS. Display Coordinates:- This refers to the actual coordinates to be used for displaying the image on the screen. 12 Coordinate systems A typical component to be modelled Rao, CAD/CAM Principles and Applications, 2010, TMH 13 Coordinate systems WCS WCS and UCS A typical component to be modelled Display Coordinates Display Coordinates A typical component with its various view positions Rao, CAD/CAM Principles and Applications, 2010, TMH 15 Display Coordinates Various views generated from the model Rao, CAD/CAM Principles and Applications, 2010, TMH 16 Introduction to Geometric transformation •Essentially, computer graphics is concerned with generating, presenting and manipulating models of an object and its different views using computer hardware, software and graphic devices. •Usually the numerical data generated by a computer at very high speeds is hard to interpret unless one represents the data in graphic format and it is even better if the graphic can be manipulated to be viewed from different sides, enlarged or reduced in size. •Geometric transformation is one of the basic techniques that is used to accomplish these graphic functions involving scale change, translation to another location or rotating it by a certain angle to get a better view of it. 17 Transformation of Geometry • Translation • Scaling • Reflection or Mirror • Rotation 18 Transformation of Geometry P*=[T]P Where [T] is transformation matrix Some of the possible geometric transformations Rao, CAD/CAM Principles and Applications, 2010, TMH 19 Transformation of Geometry Translation of the point Rao, CAD/CAM Principles and Applications, 2010, TMH 20 Translation • This moves a geometric entity in space in such a way that the new entity is parallel at all points to the old entity. Old entity :- P = [X , Y], New entity: P* =[X*,Y*] X* = X + dX or X1=X+Tx Y* = Y + dY Y1=Y+Ty X * X dX P* Y * Y dY 21 Translation Translate a triangle with vertices at original coordinates (10,20), (10,10), (20,10) by tx=5, ty=10. 22 Scaling • Scaling is the transformation applied to change the scale of an entity. • The change is done using scaling factors. There are two scaling factors, i.e. Sx in x direction Sy in y direction. Old entity :- P = [X , Y], New entity: P* =[X*,Y*] [P*] = [Ts] . [P] P* = [X*, Y*]= [Sx X, Sy dY] S x 0 * X [ P ] = 0 S y Y 23 Scaling Scaling of a plane figure Rao, CAD/CAM Principles and Applications, 2010, TMH 24 Scaling Scale a triangle with respect to the origin, with vertices at original coordinates (10,20), (10,10), (20,10) by sx=2, sy=1.5. 25 Reflection or Mirror • Reflection or mirror is a transformation, which allows a copy of the object is to be displayed while the object is reflected about a line or a plane. • The object is rotated by180°. • Types of Reflection: Reflection about the x-axis Reflection about the y-axis Reflection about an axis perpendicular to xy plane and passing through the origin Reflection about line y=x P* = [X*, Y*]= [T]P 26 Reflection or Mirror • Reflection about x-axis: The object can be reflected about x-axis with the help of the following matrix [T]= • Reflection about y-axis: The object can be reflected about y-axis with the help of following transformation matrix [T]= 27 Reflection or Mirror • Reflection about an axis perpendicular to XY plane and passing through origin: [T]= • Reflection about line y=x: [T]= 28 Reflection or Mirror Possible reflection (mirror) transformations of geometry Rao, CAD/CAM Principles and Applications, 2010, TMH 29 Reflection or Mirror Find reflected position of the Triangle (3,4), (6,4), (4,8) w.r.t X axis . 30 Rotation • It is a process of changing the angle of the object. Rotation can be clockwise or anticlockwise. • For rotation, we have to specify the angle of rotation and rotation point. Rotation point is also called a pivot point. It is print about which object is rotated • The positive value of the pivot point (rotation angle) rotates an object in a counter-clockwise direction. • The negative value of the pivot point (rotation angle) rotates an object in a clockwise direction. cos sin x * x * [ P ] = y * sin cos y 31 Rotation About the Origin • To rotate a line or polygon, we must rotate each of its vertices. y-axis (x2,y2) • To rotate point (x1,y1) to point (x2,y2) we observe: x-axis (x1,y1) • From the illustration we know that: r B sin (A + B) = y2/r cos (A + B) = x2/r sin A = y1/r cos A = x1/r A (0,0) IITK ME 761A Dr. J. Ramkumar 32 Rotation About the Origin • From the double angle formulas: sin (A + B) = sinAcosB + cosAsinB cos (A + B)= cosAcosB - sinAsinB • Substituting: y2/r = (y1/r)cosB + (x1/r)sinB • Therefore: y2 = y1cosB + x1sinB • We have x2 = x1cosB - y1sinB, y2 = x1sinB + y1cosB P2 = R P1 x cos sin x1 (x2) = (cosB -sinB) (x1) 2 [P2 ] = (y ) = (sinB cosB) (y ) y 2 1 2 sin cos y1 33 Rotation Clockwise Rotation Anti-Clockwise Rotation y-axis y-axis (x1,y1) (x2,y2) (x2,y2) (x1,y1) r r A A (0,0) (0,0) 34 Rotation about axes • Three successive rotations about the three axes rotation about the x axis rotation about the y axis rotation about the z axis 1 0 0 0 cos 0 sin 0cos sin 0 0 0 cos sin 0 0 1 0 0sin cos 0 0 0 sin cos 0 sin 0 cos 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 35 Pivot-Point Rotation (xr,y (xr,y (xr,y (xr,y r) r) r) r) Translate Rotate Translate Txr , yr R T xr ,yr Rxr , yr , 1 0 xr cos sin 0 1 0 xr cos sin xr (1 cos ) yr sin 0 1 y sin cos 0 0 1 y sin cos y (1 cos ) x sin r r r r 0 0 1 0 0 1 0 0 1 0 0 1 36 Rotation Rotation transformation Rao, CAD/CAM Principles and Applications, 2010, TMH 37 Rotation Rotate line AB whose endpoints are A(2,5) and B(6,2) about origin through 30* clockwise direction.