Surface Modelling
Surface Modelling
Avasari, Pune
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 2
CAD Entities in ZOOM view
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 3
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 4
2D Graphics Pipeline
Clipping
Object window to
Object Applying
subset viewport
World Coordinates world window
mapping
Object
Display Rasterization
Screen coordinates
Rasterization
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 6
Line Drawing
Many computer-generated pictures are composed of
straight-line segments.
A line segment is displayed by turning on a set of
adjacent pixels.
In order to draw a line, it is necessary to determine
which pixels lie nearest the line and provide the best
approximation to the desired line.
The line drawing routine should be accurate, fast,
and easy to implement.
7
The Problem of Scan Conversion
y = mx + b
where, m = Slope of the line
b = the y intercept of a line
A line segment is defined by the
coordinate positions of the line
endpoints.
We have a line with the endpoints (2,2)
and (8,7) and we want to draw this line
on a pixel based display.
How do we choose which pixels to turn on?
Following algorithms are used for line
• Digital Differential Analyzer (simple DDA) Line Drawing Algorithm
• Bresenham ’s Line Drawing Algorithm
8
Simple Digital Differential Analyzer (simple
DDA) Line Drawing Algorithm
To illustrate the idea of DDA algorithm, we still want to
draw the line segment with endpoints
(Xstart, Ystart) and (Xend, Yend) having slope :
Yend – Ystart
m=
Xend – Xstart
Any two consecutive points (x1, y1), (x2, y2) lying
on this line satisfies the equation:
y2 – y1
= m
x2 – x1
9
Simple DDA Line Drawing Algorithm
11
Simple DDA Line Drawing Algorithm
Equation 2 enables us to calculate successive values
of y from the previous value by replacing the
repeated multiplication with floating point addition.
This method of obtaining the current value by
adding a constant to the previous value is an
example of incremental calculation. Using
knowledge of one point to compute the next is a
great time saving technique.
The following code can be used to draw a line from
(Xstart, Ystart) to (Xend, Yend) using simple DDA
algorithm (case 1):
12
Simple DDA Line Drawing Algorithm
m = (Yend-Ystart) / (Xend-Xstart)
If (abs(m)<1 and Xstart>Xend) then
Swap endpoints Xstart Xend and Ystart Yend
end if
Set pixel (Xstart, Ystart) with desired color
If abs(m) < 1 then
y = Ystart
x = Xstart + 1
Next: y = y + m
Set pixel (x, Round(y)) with desired color
x=x+1
If x Xend-1 then go to Next
endif
Set pixel (Xend, Yend) with desired color
13
Simple DDA Line Drawing Algorithm
We will use the simple DDA algorithm to draw a line with starting point (2,0)
and ending point (7,4) on a pixel based display. Firstly, we compute the slope m:
m =(Yend–Ystart)/(Xend–Xstart)=(4–0)/(7–2)=4/5 = 0.8
Δx = (Xend–Xstart)=(7-2)=5
Δy =(Yend–Ystart) =(4–0) =4
Increment in X = Xstart +(Δx/5) = Xstart + 1
Increment in Y= Ystart + (Δy/5) = Ystart + 0.8
x y Round(y)
2 0
3 y = y + m = 0 + 0.8=0.8 1
4 y = y + m = 0.8 + 0.8=1.6 2
5 y = y + m = 1.6 + 0.8=2.4 2
6 y = y + m = 2.4 + 0.8=3.2 3
7 4
14
Simple DDA Line Drawing Algorithm
15
Geometrical Curve :
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 16
Methods of defining Point
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 17
Methods of defining Circle
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 18
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 19
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 20
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 21
Application of Synthetic Curves
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 22
Curve Representation
Cartesian or Non parametric
• P= [ x y z] T = [x f(x) g(x) ] T
• Curve represented by x, y and z coordinate or one to one relationship
• If the solve of curve is vertical or near to vertical it’s value become infinite or very
large so, it is difficult to deal with computationally and programme wise
• difficult to represent closed curve
• If curve displayed by as a series of points or by straight line segments, the
computation involved could be extensive.
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 23
Parametric
• P= [ x(u) y(u) z(u) ] T umin < u < u max
• Each point on curve is expressed as a function of parameter u. The parameter
acts as a local coordinate for point on curve
• Overcomes the limitation of non parametric curve
• Closed curve can easily define
• Slope is replaced with tangent
• Well suite for computation and display
• large so, it is difficult to deal with computationally and programme wise
• difficult to represent closed curve
• If curve displayed by as a series of points or by straight line segments, the
computation involved could be extensive.
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 24
Parametric Equation of Line
P P1 (P - P1)
P - P1= u (P2 -P1)
P P1 u(P2 - P1), 0 u 1
Pro.1. A Line joins two Points(3, 4, 6) & (5, 7, 1)
Find
i) The Parametric Equation of Line
ii) The tangent vector of Line
iii) The unit vector in the direction of Line
29
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari
Pro.2. Line L1 has end points (1, 2, 7) & (5, 6, 1), while
line L2 has end points (7, 3, 4) & (3, 9, 10)
i) The Parametric Equation of Line
ii) The tangent vector of Line
iii) Are the tow lines are Parallel or Perpendicular?
Iv) Are the two lines are intersecting? If yes, find point
of Intersection.
Solution :-
Given: P1 (1, 2, 7) , P2(5, 6, 1) , P3 (7, 3, 4) & P4 (3,
9, 10)
Parametric Equation of Circle
Representation 1
Non-parametric Representation
x 2
y 2
1
x = u (a )
y 1- u 2
/2 3/8
/4
x cos u /8
y sin u
(b)
u
0
xn r cos
Pn
yn r sin
Observation:
• curves are represented by a series of line-segments
• Trigonometric function cosd and sind have to calculated once only, hence it speed up the circl
generation and display
Parametric equation for point Pn with centre of circle xc and yc origin
xn xc+r c o s u
yn yc+r s i n u
xn xc = r cos u
yn yc = r sin u
x n 1 xc +r cos(u d u )
x c+ r c o s u c o s d u r s i n u s i n d u
y n 1 yc + r sin(u d u )
yc + r s i n u c o s d u r cosu sin d u
x n 1 x + ( x - x ) c o s d u ( y - y ) s i n d u
c n c n c
y n 1 y c + ( y n - y c ) c o s d u ( x n - yc ) s i n d u
36
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari
Determination of Center and Radius of circle from two end points of
Diameter
37
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari
38
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari
Prob. 2. P1(2, 3, 6) & P2 (8, 7, 6)
39
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari
40
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari
Parametric Equation of Ellips
xn xc Acosu
yn y
c
Bsinu 0 2
zn z c
Now uses the same method as in the Representation of circle to reduce the amount of calculation.
x n 1 xc +A cos(u d u )
x c+ A c o s u c o s d u A s i n u s i n d u
y n 1 yc + B sin(u d u )
yc + B s i n u c o s d u B cosu sin d u
x n 1 x + ( x - x ) c o s d u 𝐴 ( y n - yc ) s i n d u
c n c 𝐵
𝐵 41
y n 1 y c+ ( y n - y c) c o s d u ( x n - yc ) s i n d u
𝐴
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari
Parametric Equation of an inclined Ellips
An inclined ellips
42
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari
Parametric Equation of Inclined Ellips
• Also, the designer may prefer to control the shape of the curve
locally instead of globally by changing the control points.
Continuity (C0, C1 & C2)
• Shape design and the representation of complex objects such as car, ship, and airplane
bodies as well as castings cannot be achieved utilizing the curves covered in earlier.
• In such cases, surfaces must be utilized to describe objects precisely and accurately. We
create surfaces, and then we use them to cut and trim solid features and primitives to
obtain the models of the complex objects.
• Creation usually begins with data points or curves. Surface creation on CAD/CAM
systems usually requires curves as a start.
• During surface creation on a CAD/CAM system, you should follow the modeling
guidelines and strategies. Moreover, you should be careful when selecting curves to
create surfaces. Selecting the mismatching ends of curves results in twisted surfaces.
The figure shows how the wrong ruled surface is created if its defining curves are
selected near the wrong ends.
• A surface might require two boundary curves, All curves covered in this Chapter can be used to
generate surfaces. In order to visualize surfaces on computer screen, a mesh, say in n in size, is usually
displayed. The mesh size is controllable by the user.
Types of Surfaces
1. Plane surface: It is the simplest surface. It requires three non-coincident points to define an
infinite plane. The plane surface can be used to generate cross sections by intersecting a solid with
it.
2. Ruled (lofted) surface: It is a linear surface. It interpolates linearly between two boundary curves
that define the surface (rails). Rails can be any curves, this surface is ideal for representing surfaces
that do not have any twists or kinks.
3. Surface of revolution: It is an axisymmetric surface that can model axisymmetric objects. It is
generated by rotating a planar curve in space about the axis of symmetry a certain angle as shown
in Figure.
4. Tabulated cylinder: It is a surface generated by translating a planar curve a certain distance along
a specified direction (axis of the cylinder or directrix) as shown in figure. The plane of the curve is
perpendicular to the directrix. This surface is not literally a cylinder. It is used to generate extruded
surfaces that have identical cross sections.
5. Bezier surface: it is a surface that approximates or interpolates given input data. It is different
from the previous surfaces in that it is a synthetic surface. It extends the Bezier curve to surfaces.
It is a general surface that permits twists, and kinks. Bezier surface allows only global control of the
surface.
6. B-spline surface: It is a surface that can approximate or interpolate given input data.
Figure shows an interpolating example. It is a synthetic surface. It is a general surface like a
Bezier surface hut with the advantage of permitting local control of the surface.
7. Coon’s surface: The previously described surfaces are used with either open boundaries
or given data points. A Coons patch is used to create a surface using curves that form closed
boundaries .
8. Fillet surface: It is a B-spline surface that blends two surfaces. The two original surfaces
may or may not be trimmed.
9. Offset surface: Existing surfaces can be offset to create new ones identical in shape hut
with different dimensions. It is a useful surface to use to speed up surface creation. For
example, to create a hollow cylinder, the outer or inner cylinder can he created using a
cylinder command and the other one can he created by an offset command. The offset
surface command becomes very efficient to use if the original surface is a composite one.
10. NURB Surface: as stated earlier, surface defined by NURB curves.
11. Coons Surface: A Coons surface or simply Coons, is a type of manifold parameterization
used in computer graphics like CAD/CAM to smoothly join other surfaces together, and in
computational mechanics applications, particularly in finite element method and boundary
element method, to mesh problem domains into elements.
Representation of Curve in Cartesian space :
Mr. S. D. Patil, Automobile Department, Government College of Engineering and Research Avasari 87