<<

Prof. Janakarajan Ramkumar Professor Department of Mechanical & Design Program IIT Kanpur, India.

Contents

• What is Design

• Coordinate systems in CAD

• Transformation of

• 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.

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 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, 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, to another location or rotating it by a certain to get a better view of it.

17 Transformation of Geometry

• Translation

or Mirror

18 Transformation of Geometry

P*=[T]P Where [T] is transformation

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

[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  0cos  sin 0 0     0 cos  sin 0 0 1 0 0sin 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

Txr , yr  R T xr ,yr  Rxr , 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.

38 Homogeneous Representation

x * 1 0 dX  x P *  y *  0 1 dY  y          1  0 0 1  1

Concatenation of transformations • [P*] = [Tn] [Tn-1] [Tn-2] .. [T3] [T2] [T1]

39 Rotation about an arbitrary point

• Translate the point P to O, the origin of the axes system.

• Rotate the object by the given angle

• Translate the point back to its original position.

40 Rotation about an arbitrary point

Rao, CAD/CAM Principles and Applications, 2010, TMH 41 Reflection about an arbitrary line

• Translate the mirror line along the Y-axis such that the line passes through the origin, O

• Rotate the mirror line such that it coincides with the X-axis.

• Mirror the object through the X-axis.

• Rotate the mirror line back to the original angle with X-axis.

• Translate the mirror line along the Y-axis back to the original position.

42 Reflection about an arbitrary line

Rao, CAD/CAM Principles and Applications, 2010, TMH 43 Scaling about an arbitrary point

• Translate the point P to O, the origin of the axes system. • Rotate the object by the given angle • Translate the point back to its original position.

44 Scaling about an arbitrary Point

45 3D Transformations

x * 1 0 0 dX  x y * 0 1 0 dY  y        z * 0 0 1 dZ  z        1  0 0 0 1  1

46 3D Reflection

x * 1 0 0 0 x y *  0 1 0 0 y        z *  0 0 1 0 z        1   0 0 0 1 1

47 3D Rotation about Z-axis (XY plane)

x * cos  sin 0 0 x y * sin cos 0 0 y        z *  0 0 1 0 z        1   0 0 0 1 1

48 Homogeneous Representation

• Scaling, reflection and rotation transformation are in the form of but translation is in the form of matrix addition.

• This makes it inconvenient to combine transformation with translation.

• It is desirable to express all geometric transformation in the form of matrix multiplication only.

• Representing points by their provides an effective way to unify the description of geometric transformations as matrix multiplications.

• In homogeneous coordinates, an n-dimensional space is mapped into (n + 1) - dimensional space.

49

Homogeneous Representation

• In 3D space, a point P with Cartesian coordinates (x, y, z) has the homogeneous coordinates (x*, y*, z*, h) where h is any factor ≠ 0.

• The two types of coordinates are related to each other by the following equation:

• Homogeneous coordinates remove many anomalous situations encountered in Cartesian geometry .

50 Homogeneous Representation

• The homogeneous translation transformation can now be written as a matrix multiplication by adding the component of 1 to each vector, and using a matrix as follows:

x*  x  x x* 1 0 xd  x d       y*  0 1 y . y y*  y  yd    d    1 1  1  0 0 1  1 2D translation is now 3x3.

3D translation is now 4x4.

51 Homogeneous Representation

• The homogeneous scaling transformation can now be written as a matrix multiplication by adding the component of 1 to each vector, and using a matrix as follows:

sx 0 0 S   0 s 0  y   0 0 1

2D Scaling is now 3x3.

3D Scaling is now 4x4.

52 Homogeneous Representation

• The homogeneous rotation transformation can now be written as a matrix multiplication by adding the component of 1 to each vector, and using a matrix as follows:

cos sin 0  x R  sin cos 0 .y  z       0 0 1  1

2D rotation is now 3x3.

3D Scaling is now 4x4.

53 Homogeneous Representation

• The homogeneous mirror or reflection transformation can now be written as a matrix multiplication by adding the component of 1 to each vector, and using a matrix as follows:

1 0 0   M   0 1 0  0 0 1 2D reflection is now 3x3.

3D reflection is now 4x4.

54 Concatenated Transformations

• In practice a series of transformations may be applied to geometric models and thus, combining or concatenating transformations is necessary.

• Concatenated transformations are simply obtained by multiplying the matrices of the corresponding individual transformations.

• If we apply n transformations to a point starting with transformation 1, with [T1], and ending with transformation n, with [Tn], the concatenated transformation of the point is given by:

55 Concatenated Transformations

56 Concatenation

Q. The vertices of a triangle are situated at points (15, 30), (25, 35) and (5, 45). Find the coordinates of the vertices if the triangle is first rotated 10° counter clockwise direction about the origin and then scaled to twice its size.

15 25 5    P  30 35 45  1 1 1 

P*  T P

Multiplying the end points with the transformation matrix, we get new coordinates as (51.276, 73.86), (75.896, 96.16) and (39.408, 87.48) 57 Concatenated Transformations

• Rotate the box 90 degrees around an axis that runs through P and is vertical on the xy-plane. The box has side edges of length 1 and the coordinate P(2,3,4) and Q (2,4,4), find the modified P2 and Q2 .

58 Summary

• Design Methodology originated from need to final product using computers graphics was done.

• Depending upon the type of graphic display used, it is necessary to be familiar with a number of different coordinate systems to facilitate the graphic construction as well as display.

• Coordinate Systems : World Coordinate system User coordinate system Display Coordinates

• Homogeneous coordinate system

• Concatenated Transformations

59 Summary

• Geometric transformations can be handled conveniently using matrix algebra.

60 References

1. Rao, P.N., 2004. CAD/CAM: principles and applications. Tata McGraw-Hill Education .

2. Zeid, I., 1991. CAD/CAM theory and practice. McGraw-Hill Higher Education.

3. Lee, K., 1999. Principles of CAD/CAM/CAE systems. Addison-Wesley Longman Publishing Co., Inc.

4. https://www.javatpoint.com/computer-graphics-homogeneous- coordinates

61

Thank you!! Translation  Translate a triangle with vertices at original coordinates (10,20), (10,10), (20,10) by tx=5, ty=10.

63 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.

64 Reflection or Mirror  Find reflected position of the Triangle (3,4), (6,4), (4,8) w.r.t X axis .

65 66 Concatenated Transformations

67 Concatenated Transformations

68 Concatenated Transformations

• Rotate the box 90 degrees around an axis that runs through P and is vertical on the xy-plane. The box has side edges of length 1 and the coordinate P(2,3,4) and Q (2,4,4), find the modified P2 and Q2 .

69 • With our knowledge about transformations it should be a good strategy to: 1. Move the point P in to the z-axis, the matrix T1 2. Rotate around the z-axis, the matrix R 3. Move the box back, the matrix T2’

• We use the matrices in the opposite direction, and multiply from the left. We make the matrix M=T2·R·T1, and find Q2=M·Q and P2=M·P.

After the operation the point Q (2,4,4) should end up in Q2(1,3,4), and P(2,3,4) should remain in P2(2,3,4).

70 Example – for the RPP given by the matrix below obtain 3D reflection through xy – plane.

becomes Positive [X*]

71 Example – Transform the given position vector [ 3 2 1 1] by the following sequence of operations (i) Translate by –1, -1, -1 in x, y, and z respectively (ii) Rotate by +30°about x-axis and +45°about y axis The concatenated transformation matrix is: Example – Consider the following cube. Rotate it by 30º about an axis x’ passing through its centroid

73 74