Computer Aided Design AND Manufacturing

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 37

COMPUTER AIDED DESIGN

AND
MANUFACTURING
Co-ordinate Systems used in Graphics

• World Co-ordinate system (WCS)


• User Co-ordinate system (UCS)

2
Transformations
• Transformations are used to move that object, scale it
and rotate it
• 2D Transformations
• 3D Transformations

3
Translation
• Translation involves moving the element from one
location to another.
x’ = x + m, y’ = y + n y 6

Matrix notation 4

(x’ , y’) = (x , y) + T 2

T = (m , n) – Translation matrix 0
1 2 3 4 5 6 7 8 9 10
x
Note: House shifts position relative to origin

4
Scaling
• Scaling of an element is used to enlarge it or to
reduce its size.
(x’ , y’) = (x , y) S

S= (Scaling Matrix)

y
6

3 6  9
3 3
   
2

1  2 3
1  1
   
0
1 2 3 4 5 6 7 8 9 10
x
Note: House shifts position relative to origin
5
Rotation
• The points of an object are rotated about the origin by
an angle θ
(x’ , y’) = (x , y) R

R=

y
6

2


1 6

0
1 2 3 4 5 6 7 8 9 10
x 6
Reflection
• A reflection is a transformation that produces a mirror
Image of an object. The mirror image for a 2-D
reflection is generated relative to an axis of reflection by
rotating the object 1800 about the reflection axis

7
8
Concatenation

• Single transformations can be combined as a


sequence of transformations.
• The objective is to accomplish a series of image
manipulations as a single transformations.
• This allows concatenated transformation to be
defined concisely and the computation can generally
be accomplished more efficiently.

9
Homogeneous Transformations
• A point (x, y) can be re-written in homogeneous
coordinates as (xh, yh, h)
• The homogeneous parameter h is a non-
zero value such that:

• We can then write any point (x, y) as (hx, hy, h)


• We can conveniently choose h = 1 so that
(x, y) becomes (x, y, 1)

10
11
House (H )
1 2

R( )T (dx, dy ) H T (dx,dy ) R( )T (dx, dy ) H

3 4

12
 1 0 0 cos   sin  0  1 0 0  x 
 0 1  
0   sin  cos   
0   0 1   
0   y 

 Tx  Ty 1  0 0 1 Tx Ty 1 1 

13
View Port
View Port

15
Clipping
Clipping
• Clipping is the process of determining the visible
portions of a drawing lying within a window.

1. Cohen Sutherland Algorithm


2. Sutherland Hodgman Polygon Algorithm

17
Cohen Sutherland Method
• All the lines are classified to see if they are in, out or
partially in the window by doing an edge.
• The end points of the line are classified as to where
they are with reference to the window by means of a
4 digit binary code.
• The code is termed as TBRL.
T = 1, 0 otherwise : above
B = 1, 0 otherwise : below
R = 1, 0 otherwise : right
L = 1, 0 otherwise : left

18
19
• The line is inside the window if both the end points
are equal to “0000”
• The line is outside the window if both the end points
are not equal to “0000”
• The lines which are partially inside the window, they
are split at the window edge and discard the line
segment outside the window

20
Sutherland Hodgman Polygon Algorithm

• Clipping Polygon (“n” sided polygon – “n” vertices)

Clip Left Clip Right

Clip Top Clip Bottom 21


To clip an area against an individual boundary:
– Consider each vertex in turn against the boundary
– Vertices inside the boundary are saved for clipping
against the next boundary
– Vertices outside the boundary are clipped
– If we proceed from a point inside the boundary to one
outside, the intersection of the line with the boundary
is saved
– If we cross from the outside to the inside intersection
point and the vertex are saved

22
S

S
P
I

P
Save Point P Save Point I

P S

I P

S
No Points Saved Save Points I & P

23
Hidden Line
Hidden
Line
Removal
Hidden line Removal
• Determination of hidden edges & surfaces-challenging
problem in computer graphics
• Removal algorithm – built into local hardware processors of
graphic display to speed up their execution
• Removal algorithm – two types i.e. Hidden line & hidden
surface
• Former supports vector devices while latter supports raster
display
27
28
Classification of HLR Algorithm
1. Object-Space Algorithms: (the object definition directly visibility
is decided by Line of surface by line or surface)
 Back-Face Removal
 Depth Sorting (Painter Algorithm)
 Area Subdivision (Quadtrees and Octrees)
 Binary Space Partition Trees
2. Image-Space Methods algorithms (the projected image visibility
is decided point by point)
 Depth Buffer (Z-buffer)
 Scan-line
 Depth sorting (Painter Algorithm)
29
Back-Face Removal
Back-face Removal
• If the interior of the polyhedron is not exposed by the front
clipping plane then those polygons whose surface normal points
away from the camera (observer) lie on a part of the polyhedron
which is completely blocked by other polygons that are closer.
Such invisible faces called back faces can be eliminated from
processing leaving all the front faces.
• 50% of the surfaces removed from the database, which can then
be processed by the other algorithms

31
DEPTH-BUFFER METHOD
• compares surface depths at each pixel position on the
projection plane.
• This procedure is also referred to as the z-buffer method
• It utilizes the principle that for each of the pixel locations, only
that point with the smallest z-depth is displayed.
Normalized view volume

yv
xv

zv
front =
visible pixel View plane
32
• for each pixel position (x, y) on the view plane, object depths can
be compared by comparing z values.
• Surface S1, is closest at this position, so its surface intensity
value at (x, y) is saved.
• A depth buffer is used to store depth values for each (x, y)
position as surfaces are processed, and the refresh buffer stores
the intensity values for each position.
• Initially, all positions in the depth buffer are set to 0 (minimum
depth), and the refresh buffer is initialized to the background
intensity.
• Each surface listed in the polygon tables is then processed, one
scan line at a time, calculating the depth (z value) at each (x, y)
pixel position. 33
• It is simple
• Amount of storage required
• It is difficult in implementing anti-aliasing, transparency and
translucency effects.
• Pre-filtering antialiasing techniques is not easily available
• Transparency and translucency effects, the pixels may be
written to the frame buffer in incorrect order, leading to error.

34
Painters algorithm (Depth-Sort)
• This utilises the principles of principle of painting the polygons
into the frame buffer in the order of decreasing distance from the
viewpoint.

36
• Sort all the polygons according to the smallest z-coordinate of
each
• Resolve the ambiguities when the z-coordinates of the polygons
overlap, by splitting the polygons
• Scan and convert each polygon order from the back to front
yv

xv 37

You might also like