You are on page 1of 26

INDIAN INSTITUTE OF ENGINEERING SCIENCE AND TECHNOLOGY, SHIBPUR

M. E. (Mechanical) 2nd Semester Special Examination, 2020


Geometric Modeling for CAD (ME-5207)

Submission Last date : 25 JUNE 2020 (12 NOON) Full Marks: 100

Answer Q. No. 1 (compulsory) and any FOUR from the rest.


Use a single answer-script
Write answers in this Quest paper itself, start a new page for each question

Name : DEBJIT KANRAR Exam Roll : 321019001

Geometric modeling for CAD (ME-1009)

1 (a) Fig.A shows a textile machinery part which requires only two parameters a and b to
define the geometry. But depending on the size of the thread, size of a and b will change.
So we need to automate the drawing. Write an AutoLISP program to draw the part
automatically with a and b as the two user input.

a a a a a
a
b a

Fig.A
(b) Write a graphics program to display TWO cubic spline curves joined together with
the following user input data:
P1, end point of first curve; P2 : connecting point; P3 : end point of second curve;
P1’: end tangent of first curve at P2; P2’ : common tangent for both curves at P2;
P3’ : tangent at P3.
Assume that the two curves are tangent continuous at the connecting point..
[7+7]

1
ansQ1.a
The program for the above drawing in AutoLISP

(defun c: TMpart()
(setq p1 (list 0 0))
(setq b (getreal “\n give the hight”))
(setq a (getreal “\n give the divitional length a”))
(setq x1 (car p1))
(setq y1 (cadr p1))
(setq x2 ( x1))
(setq y2 (+ y1 b))
(setq p2 (list x2 y2))
(setq x3 (+ x2 a))
(setq y3 ( y2 ))
(setq p3 (list x3 y3))
(setq x4 ( x3))
(setq y4 (- y3 a))
(setq p4 (list x4 y4))
(setq x5 (+ x4 a))
(setq y5 ( y4))
(setq p5 (list x5 y5))
(setq x6 ( x5))
(setq y6 (+ y5 a))
(setq p6 (list x6 y6))
(setq x7 (+ x6 (/ a 2))) : here comes the tricky part actually this point will be use to” mirror”
(setq y7 ( y6 ))
(setq p7 (list x7 y7))
(setq x8 (+ x1 (* a 2.5))) : p8 point alsowill be use to” mirror”
(setq y8 ( y1 ))
(setq p8 (list x8 y8))
(setq x9 (+ x1 (* a 1.5))
(setq y9 ( / ( - b a) 2))
(setq p9 (list x9 y9)) : this point is used as the centre of the hole
( command “pline” p8 p1 p2 p3 p4 p5 p6 p7 “c”)
(setq obj1 (ssget “Last”) ) : this code actually select object Last added.
( command “circle” p9 (/ a 2))
(setq obj2 (ssget “Last”))
( command “mirror” obj1 obj2 “” p7 p8””) :mirror command takes obj selection lst and then
) point of mirror line in 2d

2
P7

P2 p3
P6
P4 p5 a
b a

a
P1
P9 Fig.A

Mirror line p8

The above figure is the figure of auto cad , as programming is not done for showing dimension
In image plot of the same it is not shown ….here b is taken 100 mm and a is taken 30 mm

3
Ans .b
Program of cubic spline curve in matlab editor
a0 = load ( cubic-spline.dat);
x1 = a0(1,1);
y1 =a0(1,2);
x2 = a0(2,1);
y2 =a0(2,2);
x3 = a0(3,1);
y3 =a0(3,2);
xt1 = a0(4,1);
yt1 =a0(4,2);
xt2 = a0(5,1);
yt2 =a0(5,2);
xt3 = a0(6,1);
yt3 =a0(6,2);
i=1;
for u = 0.0:0.01:1.0;
f1 = (2*u.^3 -3*u.^2 +1); :as u is incremental varring quantity before each mathametical
f2 = (-2*u.^3 +3*u.^2 ); operation . is required
f3 = (u.^3 -2*u.^2 +u);
f4 = (u.^3 –u.^2 );
xc(i) =(f1.*x1 +f2.*x2+f3.*xt1+f4.*xt2);
yc(i) =(f1.*y1 +f2.*y2+f3.*yt1+f4.*yt2);
xc1(i) =(f1.*x2 +f2.*x3+f3.*xt2+f4.*xt3);
yc1(i) =(f1.*y2 +f2.*y3+f3.*yt2+f4.*yt3);
i=i+1;
plot (xc,yc)
hold on
plot (xc1,yc1 , ‘b’)
here for the plot x1=-2,y1=0,x2=0,y2=1,x3=2,y3=0,xt1=xt2=xt3=3,yt1=yt2=yt3=0,

4
The actual program for this curve
x1 = (-2);y1 =0;
x2 =0;y2 =1;
x3 =2;y3 =0;
xt1 =3;yt1 =0;
xt2 =3;yt2 =0;
xt3 =3;yt3 =0;
u = 0.0:0.01:1.0;
f1 = (2*u.^3 -3*u.^2 +1);
f2 = (-2*u.^3 +3*u.^2 );
f3 = (u.^3-2*u.^2 +u);
f4 = (u.^3-u.^2 );
xc =(f1.*x1 +f2.*x2+f3.*xt1+f4.*xt2);
yc =(f1.*y1 +f2.*y2+f3.*yt1+f4.*yt2);
xc1 =(f1.*x2 +f2.*x3+f3.*xt2+f4.*xt3);
yc1 =(f1.*y2 +f2.*y3+f3.*yt2+f4.*yt3);
plot (xc,yc)
hold on
plot (xc1,yc1)
axis equal

this is a bit easier as matrix format of input is not necessary when control points are known
by programmer himself.

5
2 (a) Construct a ruled surface by liner blending of the curves P(0,v) and P(1,v) which are
two Bezier curves and also make an labeled sketch of the resulting surface. The control
points for P(0,v) are : [0 0 0], [1 1 0], [2 1 0] and [3 0 0]. Control points for P(1,v) are
: [0 0 6], [1 1 6], [2 1 6] and [3 1 6].
(b) Write the exact procedure to check whether a surface is developable or not.
(c) What is Euler’s rule of curvature?
[7+4+3]

Ans2.a.
As according to the question we can see for each curve in case of control points the value
Of ‘z’ is constant so the two curve will be form at x-y plane at two different position
So for each curve we can implement 2d cubic bazier curve
Program for p(o,v)

x1=0; y1=0;
x2=1; y2=1;
x3=2; y3=1;
x4=3; y4=0;
u=linspace(0,1,50);
f1= ((1-u).^3);
f2= (3*u.*(1-u).^2);
f3= (3*(1-u).*u.^2);
f4= u.^3;
xc=(f1.*x1+f2.*x2+f3.*x3+f4.*x4);
yc=(f1.*y1+f2.*y2+f3.*y3+f4.*y4);
plot (xc,yc)
axis equal

2d Plot of p(o.v) curve

6
Program for p(1,v) curve

x1=0; y1=0;
x2=1; y2=1;
x3=2; y3=1;
x4=3; y4=1;
u=linspace(0,1,50);
f1= ((1-u).^3);
f2= (3*u.*(1-u).^2);
f3= (3*(1-u).*u.^2);
f4= u.^3;
xc=(f1.*x1+f2.*x2+f3.*x3+f4.*x4);
yc=(f1.*y1+f2.*y2+f3.*y3+f4.*y4);
plot (xc,yc)
axis equal

2d plot of p(1,v) curve

7
two different curved can be visualized from top view

8
3d ruled surface generated
Here in the picture please note the upper curved edge is P(0,v)curve
Lower one is p(1,v) curve as the image is viewed from -z axis

9
3d ruled surface generated
Same surface in different orbital states
Here the right hand upper edge is P(1,v) curve
And lower left edge is P(0,v) curve.
The above surface is generated by surface design in AUTOCAD

10
b.
to determine weather a surface or a portion of surface is developable or not ,it is necessary to
consider the curvature of the parametric surface. At any point ‘P’ on a surface the curve of
intersection of a plane containing the normal to the surface at ‘P’ and the surface has a curvature
‘k’ , as the plane is rotated about the normal (at point ‘p’) the curvature gradually changes .
there are two different unique direction for which the curvature is maximum and minimum,
hence the curvature at these direction are called principle direction…denoted as ‘ k’max and
‘ k’min
two combination of these principle curvature Gaussian curvature and average

𝐾 = 𝑘𝑚𝑎𝑥 ∗ 𝑘𝑚𝑖𝑛

𝑘𝑚𝑎𝑥 + 𝑘𝑚𝑖𝑛
𝐻=
2

now for a developable surface the Gaussian curvature 𝐾 = 𝑘𝑚𝑎𝑥 ∗ 𝑘𝑚𝑖𝑛 = 0

c.
the great mathematician EULER showed that there are two different unique direction for which
the curvature is maximum and minimum,
hence the curvature at these direction are called principle direction…denoted as ‘ k’max and
‘ k’min
and these direction (for munumum and maximum curvature ) are basically orthogonal to each
other .

11
3 a) Write a complete program to generate a surface of revolution created by revolving a
cubic Bezier curve about X-axis.
b) Find the equation of the surface of tabulated cylinder that is defined by a quarter of a
circle of radius 5 units as shown in Fig.B. The cylinder is parallel to Z-axis and the length
in that direction is 16 units.
Y

R5

(6,2)
X

Fig.B
[8+6]

Ans Q3.a.
The equation of a Bézier curve is given by:

Q ( t)=∑𝑛𝑖=0 𝐵𝑖 𝑗𝑛,𝑖 (𝑡)


Here
𝑛!
𝑗𝑛,𝑖 (𝑡) = 𝑡 𝑖 (1 − 𝑡)(𝑛−𝑖)
𝑖! (𝑛 − 𝑖)!

PROGRAM
x1=1; y1=3;
x2=1; y2=1;
x3=4; y3=2;
x4=4; y4=3;
u=linspace(0,1,50);
f1= ((1-u).^3);
f2= (3*u.*(1-u).^2);
f3= (3*(1-u).*u.^2);
f4= u.^3;
xc=(f1.*x1+f2.*x2+f3.*x3+f4.*x4);
yc=(f1.*y1+f2.*y2+f3.*y3+f4.*y4);
plot (xc,yc)
axis equal
[X,Y,Z]= cylinder(yc);
surf(X,Y,Z)
axis square

here the Bezier cubic curve is drawn taking


(1,3) (1,1) (4,2) (4,3) points

12
Fig4 plot of the curve

13
Fig5 revolved generated surface

14
b.
𝑥2 𝑦2 𝑧2
for any rotarary surface we know 2
+ 2
+ =1
𝑎 𝑏 𝑐2
if the origin is at 0,0,0

here z is independent and varies from 0 to 16 .

now for right cylinder along z axis c=infinity.

And a=b= radius of the cylinder ( R) here.

Here R=5 unite , the origin is at (6,2)

So in the above equation we replace x by (x-6), and y by (y-2).

(𝑥 − 6)2 (𝑦 − 2)2
+ =1
52 52
Which comes out to be as

𝑥 2 − 12𝑥 + 𝑦 2 − 4𝑦 + 40 = 25

𝑥 2 − 12𝑥 + 𝑦 2 − 4𝑦 + 15 = 0 for 6 ≤ x ≤ 11
Type equation here.
2≤y≤7

0 ≤ z ≤ 16

The above equation is the equation of the surface of the shown cylinder ,note its basically a
equation of circle as the right cylinder axis is parllel to z axis.

15
4. (a) Find N8,3(u) of the B-Spline curve for n+1=12, k=3.
(b) Explain the difference of convex hull property between Bezier curve and B-Spline curve.
(c ) What is the advantage of B_Spline curve over Bezier Curve in terms of control points?
Explain with examples.
[7+4+3]

Ans Q4.a
We know that for a B-spline curve the
The basis function

(𝑢−𝑢𝑖 ) 𝑖+𝑘 (𝑢 −𝑢 )
𝑁𝑖,𝑘 (𝑢) = (𝑢 𝑁𝑖,( 𝑘−1) (𝑢) + 𝑁𝑖+1,(𝑘−1) (𝑢)
𝑖+𝑘−1 −𝑢 )
𝑖 (𝑢 −𝑢 𝑖+𝑘 𝑖+1 )

Now here given that


n+1=12, k=3

so parameter range 0 ≤ u ≤ n-k+2

0 ≤ u ≤ 10
and number of element will be n+k+1=15.
For k=3 at 1ast and last of the knot vector there will be 3 repeatetion
Hence the knot vector is

𝑢𝑖 =[0 0 0 1 2 3 4 5 6 7 8 9 10 10 10 ]
Here the changes occure every case except i=1,2,13,14.

𝑁1,3 𝑁2,3 𝑁3,3 𝑁4,3 𝑁5,3 𝑁6,3 𝑁7,3 𝑁8,3 𝑁9,3 𝑁10,3 𝑁11,3 𝑁12,3
𝑁1,2 𝑁2,2 𝑁3,2 𝑁4,2 𝑁5,2 𝑁6,2 𝑁7,2 𝑁8,2 𝑁9,2 𝑁10,2 𝑁11,2 𝑁12,2
𝑁1,1 𝑁2,1 𝑁3,1 𝑁4,1 𝑁5,1 𝑁6,1 𝑁7,1 𝑁8,1 𝑁9,1 𝑁10,1 𝑁11,1 𝑁12,1

𝑁8,1 =1, 𝑁9,1 =1, 𝑁10,1 =1

So applying the main equation we get

16
(𝑢−𝑢9 ) (𝑢9+2 −𝑢 )
𝑁9,2 (𝑢) = (𝑢 𝑁
) 9,(2−1)
(𝑢) + (𝑢 𝑁9+1,(2−1) (𝑢)
9+2−1 −𝑢8 9+2 −𝑢9+1 )

(𝑢 − 6) (8 − 𝑢 )
𝑁9,2 (𝑢) = 1+ 1
(7 − 6) (8 − 7)

=2
(𝑢 − 𝑢8 ) (𝑢8+2 − 𝑢 )
𝑁8,2 (𝑢) = 𝑁8,(2−1) (𝑢) + 𝑁 (𝑢)
(𝑢8+2−1 − 𝑢8 ) (𝑢8+2 − 𝑢8+1 ) 8+1,(2−1)

(𝑢 − 5) (7 − 𝑢 )
𝑁8,2 (𝑢) = 1+ 1
(6 − 5) (7 − 6)

=2

Now we got 𝑁8,2 (𝑢) and 𝑁9,2 (𝑢).


Now

(𝑢 − 𝑢8 ) (𝑢8+3 − 𝑢 )
𝑁8,3 (𝑢) = 𝑁8,2 (𝑢) + 𝑁 (𝑢)
(𝑢8+3−1 − 𝑢8 ) (𝑢8+3 − 𝑢8+1 ) 9,2

(𝑢 − 5) (8 − 𝑢 )
𝑁8,3 (𝑢) = 2+ 2
(7 − 5) (8 − 6)
=3.

b. Difference of convex hull properties between Bezier curve and B-spline curve

17
• In case of Bezier curve only a single convex hull is formed taking all the control
points from 1st one to the last one . so in case of Bezier curve the number of points
actually control the degree of polynomial ( n-1) which actually makes the curve stiff.

On the other hand in case of B-Spline curve the number of convex hull depends on the
value of k directly as number of convex hull = n-k+1,
So changing the value of k the flexibility of B-spline curve can be changed.

• Only one Bezier curve can be drawn for given fixed number of points
But numbers of B-spline curve can be drawn for same number of points by changing k
value due to its convex hull property.

• A Bezier curve never goes through the points except end points

But due to the convex hull property of b-spline curve it can be drawn through multiple
number of points if those points lie on a single line.

18
c.
from the aspect of control points B-spline curve is more flexible than Bezier curve
as in case of Bezier curve the number of control points directly controls the degree of
polynomial of the curve , it makes the curve stiffer , and so if any point on the curve is
moved inward or outward with respect to the polygon some global shape cganges are
observed that means moving of any single point will effect the overall shape of the Bezier
curve.
But unlike a Bezier curve in case of a B-Spline curve the degree of polynomial depends
on k so it is independent of the number of control points . in the equation of B-Spline
curve the coordinate of a single point can be put multiple times which enable the point to
dominate on a local position on the curve ,hence in case local change can be achieved.
and moving a single point of B-spline curve only local changes are observed as in this
case moving of a single point will make a slight change in the two adjunct convex hull .

19
20
5. (a) Derive the equation of cubic spline curve.
(b) Determine the equation of cubic spline curve from given end points and slopes at the
end points with tangent magnitude equal to 1.
Point A : [1 2] slope (A) = 600
Point B : [3 1] slope (B) = 300
Make an approximate plot of the resulting curve.
[7+7]

Ans Q5.a

As we know that for a cubic spline curve the governing equation is


P(u) =a+b*u+c*u2+d*u3
If the end points are ‘p(0)’ and ‘p(1)’ and the end tangent vector are ‘pt0’ and ‘pt1’
As u varies from 0 to 1.we can write that
P(0)=a. ……..eq1 as u= 0 here.
P(1) =a+b+c+d…………eq2 as u=1
P’(u) = b+2cu+3du2 .
P’(0) = b …………eq3
P’(1) =b+2c+3d ……….eq4

From eq 4 and eq3 we can wrire

P’(1)- P’(0) =2c+3d ……eq5

now applying eq2 and eq1 we get

c+d= P(1)-P(0)-P’(0)……….eq6

21ultiplying eq6 by 2 and subtracting the result from eq 5 we get

d= 2P(0)-2P(1)+P’(0)+P(1).

Putting this value of d in eq6 we get

21
c= 3P(1)-3P(0)-2P’(0)-P’(1).

Now putting the values of a, b, c, d in the governing equation


We get

P(u)= P(0)-uP’(0)+3u2P(1)-3u2P(0)- 2u2P’(0)-u2P’(1)+ 2u3P(0)-2u3P(1)+


u3P’(0)+ u3P’(1)

P(u)= (2u3- 3u2+1)*P(0) +(-2u3+3u2)*P(1)+ (u3- 2u2+u)*P’(0)+ (u3-


u2)*P’(0) ;

The above derived equation is the equation of CUBIC –SPLINE curve.

22
b.
According to the question for the cubic spline curve thethe end points are
Poimt ‘A’=(1,2). Point ‘B’=(3,1)
Slop at A is = 60ᵒ and at point B slop is =30ᵒ.
And the magnitude of the tangent vector is 1 for each case so the tangent vector at point A
will be P’(A) = (1*cos 60, 1*sin 60)=(0.5, 0.866)
tangent vector at point A will be P’(B) = (1*cos 30, 1*sin 30)=(0.866,0.5)
so accordingly the equation becomes

X(u)= (2u3- 3u2+1)*1+(-2u3+3u2)*3+ (u3- 2u2+u)*0.5+ (u3- u2)*0.866 ;

Y(u)= (2u3- 3u2+1)*2+(-2u3+3u2)*1+ (u3- 2u2+u)*0.866+ (u3- u2)*0.5;

Below picture shows a typical rough scatch of the curve

(0.5,0.866) vector

60ᵒ
2
A (0.866,0.5) vectot

30ᵒ
1 B

X
1 2 3

23
6. (a) Suppose there is an arbitrary curve in 2-D plane. Now there is a requirement that the
same curve is to be reconstructed as a Bezier curve. Write in detail the procedure to make it a
Bezier curve, highlighting how to get the control polygon for the curve.
(b) Now write how to convert the above Bezier curve as a Bezier curve with 5 control points?
(c) What should be the criteria for joining a cubic spline curve with a cubic Bezier curve?
[5+5+4]

7. (a) Explain with an example the binary tree for solid modeling in CSG technique.
(b) Explain difference between wireframe modeling and solid modeling.
(c ) Explain why database is important for a CAD software.
(d) Explain in brief, how CAD can be directly interfaced to CAM?
[4+3+3+4]

ans Q7.a.

Tree: A tree is an acyclic digraph in which a single node called root node has a zero

indegree and every other nodes has an indegree of one .


Binary Tree: In a tree if the descendent of each node are in order (from left to right) and
each node except the leaf node has two decedents (left and right), then the tree is
called a binary tree.

b.
Wire frame and solid models give visual renderings of 3D objects for computer-aided
design and manufacturing programs. The main difference between wire frame and solid
models concern the amount of surface detail.
Wire Frame:
o Just the outlines of the 3D object with information about the edges, nodes,
and vertexes
o Transparent: no coloring or solid fill
o No indication of material thickness
o No provision for bend allowances
o No detail on hole specifics (i.e. countersink, thread, etc.)
o Files are light in size and regenerate easily on the screen

Solid Model:
o More detailed and realistic representation of an object
o Not transparent: include information about edges, nodes, and vertexes in
addition to coloring, solid fill, surface features, and volume
o Material type still needs to be added in the notes

24
o Welding fillets typically not shown
o Files are larger than wire frame files and regenerate less easily

c. requirement of cad data base


There are generally three approaches to the task of giving a systematic presentation
of the requirements of CAD databases
. what most essentially characterizes a CAD database lies in
the fact that it is an informational model of a part of the real, physical world
containing those entities (design objects) that we human beings create, sense,
manipulate and think about.
We classify approximately two dozen requirement
items into three categories as follows:

(1) Structures and Semantics


(1.1) Shapes, motions, tolerances, form features, etc.
(1.2) Long and variable-Iength attribute fields
(1.3) Abstract typing of attribute domains
(1.4) Organization by hierarchy
(1.5) Organization by classification
(1.6) More complex structures
(1. 7) Manipulation of complex objects
(1.8) Support of multiple views
(1.9) Support of multimedia representations
(1.10) Semantics of objects, attributes and functions

(2) Dynamic Aspect


(2:1) Liberal (unrestricted) choice of access methods
(2.2) Dynamic extension and modification of schema
(2.3) Specification and validation of integrity constraints
(2.4) Security and protection
(2.5) Backtracking on the design path
(2.6) Arbitrarily long transactions
(2.7) Replication of arbitrary portions of database
(2.8) Private workspaces
(2.9) Support of distributed databases

(3) Version Control


(3.1) Support of alternate designs
(3.2) Control of versions and releases
(3.3) Maintenance of the history of changes
(3.4) Archive for past designs

d. how CAD can be interfaced to CAM


Although CAD and CAM have developed tremendously over the last several years. these two systems have been developed as
separate islands of development with little attention given to system integration and interdisciplinary capability and data
communication. For total system integration, it is essential that data be shared and exchanged among all disciplines, that data
redundancy be minimized, and that a universally acceptable standard be established.
The important element that provides the bridge between CAD and CAM is the interface--the database and communication
linkage. Although the needs and problems of CAD/CAM integration have been
suggested by many researchers , many challenges must be faced before a complete integration will be practical. A recent report
of the committee on the CAD/CAM interface provides an excellent
summary of the current issues in the interface challenge. Recent efforts to integrate CAD/CAM generally generated from the
CAD data, a process plan, NC tool path or set of manufacturing information about the part. One of these efforts is a software for
automated drafting and manufacturing program called AD 2000 Using AD 2000, one can create a 3-D part by defining all
surfaces. Some NC tool paths can be calculated by storing a limited amount of

25
topology, but the resulting paths are always subject to visual verification by the user. The limitatiomof AD 2000 are that the
program does not check for tool interference nor does it guarantee that a designed part is geometrically and topologically
realizable. The work of Grayer {l2}, Chan {l3}, Chang {l4} have used a solid modeling
data base. Their research efforts have attempted either to determine the machine sequence for some previously known feature for
NC path determination or to decompose the part into primitive volumes of arbitrary shapes. The applications of these methods are
limited because they have been developed to only certain specific feature types .. The research efforts of Woo {l5}, Armstrong
{l6}, and Kyprianou {l7} made significant contribution toward the simplification and improvement of a link between CAD/CAM
systems.

26

You might also like