Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Ch 3 Computer Graphics
Objectives
Convert vector straight lines to raster images to be displayed on a raster terminal utilizing the pixel information Understand the problems associated with displaying vectorial information on a raster terminal Various types of coordinate systems used in displaying CAD information The data requirements of a graphic image and the database storage methods used Different types of geometric transformations used during CAD geometry generation and display and their evaluation Mathematics required to display a 3D image on the 2D screen of the display device Understand the problems associated with the display of graphic images in the display screen such as clipping and hidden line elimination
CAD/CAM Principles and Applications by P N Rao, 2nd Ed 2
y2 y1
x1 x2
CAD/CAM Principles and Applications by P N Rao, 2nd Ed
X
4
Calculate dx = x2 - x1 dy = y2 - y1
Yes
St = |dx|
dx = dx / ST dy = dy / ST X = xi Y = yi Set pixel at X, Y X = X + dx Y = Y + dy
i+1 y i i i+1
d2 d1
X
7
Fig. 3.4 Flow chart for line drawing calculation using Bresenham procedure
x=x+1
If Pi < 0
No
No
Fig. 3.5 The staircase effect of pixels when drawing inclined lines
10
Fig. 3.6 The staircase effect of pixels when drawing inclined lines decreases with increased resolution
11
Fig. 3.7 Antialiasing of pixels proportional to the portion of pixel occupied by the line
8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 8
12
Fig. 3.8 Unequal number of lines displayed with the same number of pixels
13
14
60
120
40
40
20
15 0
30
15
16
Z Y
17
19
Display Co-ordinates
This refers to the actual co-ordinates to be used for displaying the image on the screen.
20
Z Y FRONT X
CAD/CAM Principles and Applications by P N Rao, 2nd Ed 21
RIGHT SIDE
Fig. 3.13 Various views generated from the model shown in Fig 3.12
60 90 20
Y X
Z
50
TOP
60
120
X Y
30
Z
150
40
Z Y X RIGHT SIDE
FRONT
20
22
23
SURFACE
25
Solid body
Faces
Edges Vertices
26
27
28
dX
dY
Translation
Scaling
Y
25
30
X
25
Rotation Reflection
CAD/CAM Principles and Applications by P N Rao, 2nd Ed 29
X' Z
X
CAD/CAM Principles and Applications by P N Rao, 2nd Ed 30
P*
P X'
dX
X
CAD/CAM Principles and Applications by P N Rao, 2nd Ed 31
P*
sY
P
Y
X sX
32
28 25
28
X
25
-X
-X
-Y
33
P y
X P* -y
CAD/CAM Principles and Applications by P N Rao, 2nd Ed
34
Y P* y* P
r y
x*
X x
35
13.66
8.66
10
30
3.66 5 8.66
36
37
38
39
P* r A dY P
X dX
CAD/CAM Principles and Applications by P N Rao, 2nd Ed 40
O
CAD/CAM Principles and Applications by P N Rao, 2nd Ed
X
42
3.5 3D Transformations
x * 1 y * 0 = z * 0 1 0 0 0 dX 1 0 dY 0 1 dZ 0 0 1 x y z 1
43
44
Projecting plane
45
B E
C Y
A D
46
BOTTOM VIEW
47
3.7 Clipping
48
B
CAD/CAM Principles and Applications by P N Rao, 2nd Ed 49
Fig. 3.31 The 4-digit coding of the line end points for clipping
51
52
Fig. 3.34 Back-face removal using the face normal and projecting ray
Z Y P X
CAD/CAM Principles and Applications by P N Rao, 2nd Ed
N
53
Summary
In order to display the graphical information, which is vectorial in nature, it is necessary to convert it into raster format. For converting lines into raster format, DDA algorithm is simplest while Bresenhams algorithm reduces the computations into integer format thereby making it a faster alternative. It is necessary to modify the pixel information for display to get more realistic visual experience. 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. In addition to the actual graphic information, a large amount of additional data such as organizational and technological data is stored with the product data.
54
Summary
Geometric transformations can be handled conveniently using matrix algebra. For this purpose it is necessary to use homogenous representation of vertex data. Various transformations that are quite useful are translation, rotation, scale and reflection. The 2D transformation methods can be easily extended into 3D. The 3D geometry data needs to be converted into 2D by adopting a suitable projection system such as orthographic, isometric or perspective projection. Since only part of the geometric model will be displayed most of the time, it is necessary to clip the information outside the display window. Also it is necessary some times to remove the hidden lines to make the display easier to understand. For this purpose back face removal and depth buffer (Z) are used.
CAD/CAM Principles and Applications by P N Rao, 2nd Ed 55