Curves (Analytic)
Curves (Analytic)
Curves (Analytic)
Backend
1
Review of Computer Aided Design
Geometric Modelling
Software based approach
Mathematical Foundation
Computer Graphics
Software based approach
Mathematical Foundation
4
Coordinate Systems
Screen Coordinate System (SCS)
Model Coordinate System or Global Coordinate
System | (MCS/GCS)
Working Coordinate System or Local Coordinate
System (WCS/LCS)
Viewing Coordinate System (VCS)
5
Objectives of Computer Aided Design
Better visual representation
User friendly
Computationally inexpensive (CPU memory, CPU
time)
Reduced calculations to produce geometry
6
Parametric versus Non-Parametric
Representation of a Solid Model
7
Representation of Point in Cart CS
P (x,y)
8
Vector-Matrix Representation of Point
P (x,y,z)
P(x,y,z) = P [x y z]T
p(x,y,z)
P
9
What is Non-Parametric Representation?
It is also called as Algebraic Representation in a
simple form.
10
(a) What is Explicit Representation?
• Curve in 2D: y = f(x)
11
Disadvantages of Explicit Representation
12
(b) What is Implicit Representation?
Curve in 2D: f(x,y) = 0
– Line: ax + by + c = 0
– Circle: x2 + y2 – r2 = 0
Surface in 3D: f(x,y,z) = 0
– Plane: ax + by + cz + d = 0
– Sphere: x2 + y2 + z2 – r2 = 0
f(x,y,z) can describe 3D object:
– Inside: f(x,y,z) < 0
– Surface: f(x,y,z) = 0
– Outside: f(x,y,z) > 0 | What are the drawbacks?
13
Disadvantages of Implicit Representation
Equation must be solved to find its roots (y and
z values) if a certain value of x is given.
14
Disadvantages of Implicit Representation
P(u)
P(x,y,z) = P(u) = [x(u) y(u) z(u)]T
16
Advantages of Parametric Form
1. Suitable for closed and multi-valued curve
2. When x’(u) = 0, the slope is infinite. Hence an infinite
slope can be defined by letting one component of the
tangent vector be zero. Computational difficulty is
avoided by using a parametric derivative.
3. Since a point on a parametric curve is specified by a
single parameter (u), the parametric form is axes
independent.
4. The curve end points and length are fixed by the
parametric range umin≤u≤umax
Often, it is convenient to normalize the range as 0≤u≤1
17
Modeling Analytic Curves
(Circle)
18
Non-Parametric Representation of a Circle
Generate a circle using an Implicit Equation of Circle:
x2 + y2 = 1.
Take equal increment in x (say 0.25) and obtain y.
y = +(1 – x2)1/2
No. x y
1 0 1
2 0,25 0.97
3 0.5 0.86
4 0.75 0.66
5 1 0
19
Observations of
Non-Parametric Representation of a Circle
20
Parametric Representation of a Circle
Generate a circle using a Parametric Equation.
Take equal increments in θ (say π/8) to obtain
coordinates points x and y.
22
We Need an Efficient Algorithm
Parametric Representation of a Circle
23
Need of Efficient Algorithm
Parametric Representation of a Circle
24
Need of Efficient Algorithm
Parametric Representation of an origin
centered Circle
The Cartesian coordinates of any point on an origin –
cantered circle are then
xi = r cosui
yi = r sinui ----------------------------------(a)
Let’s take δu as an increment
xi+1 = r cos(ui + δu)
yi+1 = r sin(ui + δu) -------------------------(b)
Using the sum of the angles formulae yields
xi+1 = r (cosui*cosδu - sinui*sinδu)
yi+1 = r (cosui*sinδu + sinui*cosδu) -------(c)
With Equation (a)
xi+1 = xi *cosδu - yi * sinδu
yi+1 = xi *sinδu + yi * cosδu ----------------(d) 25
Need of Efficient Algorithm
Parametric Representation of an origin
centered Circle
Recursive Relation
xi+1 = xi *cosδu - yi * sinδu
yi+1 = xi *sinδu + yi * cosδu ----------------(d)
26
Need of Efficient Algorithm
Parametric Representation of an origin centered
Circle
xi+1 = xi *cosδu - yi * sinδu
yi+1 = xi *sinδu + yi * cosδu ----------------(d)
Eqn (d) represents the rotation of the point xi and yi by an “δu”.
δu = 2π/n-1 where, n = number of segments
The value of cosδu, sinδu need to be calculated once.
The resulting algorithm represents only four multiples, one
addition and one subtraction in the inner loop. This way the
algorithm becomes efficient.
Thus the circle can start from an arbitrary point and successive
points with equal spacing can be calculated recursively. This
eliminates computation of trigonometric functions for each point.
This algorithm is useful for hardware implementation to speed up
the circle generation and display.
27
Need of Efficient Algorithm
Parametric Representation of a non-origin
centered Circle
For a non-origin cantered circle is
obtained by translating an origin-
centered circle of appropriate radius.
Equations (a) and (b) becomes
xi = xc + r.cosui
yi = yc + r.sinui -------(a’)
28
Model Solution
Generate a circle of radius 2 with centre (2,2). Take 8 segments.
No of segments = 8, n = 8. We need n+1 points (starting (θ=0) and
closing point (θ=2π) will coincide).
29
Model Solution
Generate a circle of radius 2 with centre (2,2). Take 8 segments.
30
Model Solution
Generate a circle of radius 2 with centre (2,2). Take 8 segments.
31
Model Solution
Origin centered Non-Origin centered
i
1 2 0 4 2
2 3.414 3.414
3 0 2 2 4
4 0.586 3.414
5 -2 0 0 2
6 0.586 0.586
7 0 -2 2 0
8 3.414 2.586
9 2 0 4 2 32
an Efficient Algorithm [Tut]
Generate an efficient algorithm to generate a circle which is (a)
passes through corners of a square (b) which is inscribed in a square
Pc = (P1+P3)/2 = OR = (P2+P4)/2
33
an Efficient Algorithm [Tut]
Generate an efficient algorithm to generate a circle which is (a)
passes through corners of a square (b) which is inscribed in a
square
Pc = (P1+P3)/2 = OR = (P2+P4)/2
34
an Efficient Algorithm [Tut]
Generate an efficient algorithm to generate a circle which is
concentric to existing circle (Black coloured) shown in Fig.
Ri = R-d | Ro = R+d
35
General Problem
Non-parametric equation of a circle is given by x2+y2=R2 where x =
R.cos(2πu) and y = R.Sin(2πu).
(a)Represent Equation of circle in a parametric form
(b)Using the resulting equation, write down the tangent equation
(c)Find out Tangent Equations at 0o, 45o, 90o
(d)Find out slopes at 0o, 45o, 90o
37
General Problem
38
Need of Efficient Algorithm
39
Need of Efficient Algorithm
40
Circular Arc
Circle and circular arcs are among the most common
entities used in wireframe modelling. Circle and circular arcs
together with straight lines are sufficient to construct a large
percentage of existing mechanical parts and components in
practice.
Database requirement of a circle is its centre and radius as
its essential geometric data. If the user input data is
insufficient to define the plane of the circle, then general
softwares assume XY-plane (by default) for the construction.
Circle can be generated by many ways. The intention of the
algorithm (software) is to convert user’s input information
into radius and centre, which is the requirement of circle
database.
41
Circular Arc Parametric Equation
43
Parametric Representation of a Line
44
Parametric Representation of a Line
P = P1+ (P–P1)
P-Equation:
47
Parametric Representation of a Line
48
Model Solution for a Parametric Line
For the position vectors: P1[2 3] and P2[4 5]
(a)Write down a parametric equation
(b)Write down a scalar form
(c)Write down a Tangent Vector
(d)Find out slope
(e)Find out length
(f) Unit vector in the line direction
49
Model Solution for a Parametric Line
For the position vectors: P1[2 3] and P2[4 5]
(a)Write down a parametric equation
P(u) = [2 3] + u([2 2]
50
Model Solution for a Parametric Line
For the position vectors: P1[2 3] and P2[4 5]
(b) Write down a scalar form
51
Model Solution for a Parametric Line
For the position vectors: P1[2 3] and P2[4 5]
(c)Write down a Tangent Vector
(d)Find out slope
52
Model Solution for a Parametric Line
For the position vectors: P1[2 3] and P2[4 5]
(e) Find out length
53
Model Solution for a Parametric Line
54
Parametric Line [Tut-1]
For the position vectors: P1[1 2 3] and P2[4 5 6]
(a)Write down a parametric equation
(b)Write down a scalar form
(c)Write down a Tangent Vector
(d)Find out slope
(e)Find out length
(f) Unit vector in the line direction
55
Parametric Line [Tut-2]
56
Parametric Line [Tut-3]
Correlate the following CAD/M command to it’s
mathematical foundation: The command that
measures the angle between two intersecting lines.
57
Parametric Line [Tut-4]
Find equations of 3 lines: L1, L2 and L3 shown in
Fig. Are L1 and L2 perpendicular? Are L1 and L3
parallel?
58
Parametric Line [Tut-4]
Find equations of 3 lines: L1, L2 and L3 shown in
Fig. Are L1 and L2 perpendicular? Are L1 and L3
parallel?
L1 & L2 Perpendicular:
59
Parametric Line [Tut-5]
Find angles between pair of lines in (a) and (b).
4,4 4,4
(a) (b)
5,5 5,5
1,1 1,1
3,3 3,3
61
Parametric Line [Tut-5]
62
Parametric Line [Tut-5]
63
Parametric Line [Tut-5]
64
Modeling Analytic Curves
(Ellipse)
65
Representation of an Ellipse
Database Requirement:
67
Representation of an Ellipse
Equal segments Method
68
What is desired???
Let: xi = acosui
yi = bsinui
xi = acosui xi, yi
yi = bsinui ……..(a)
Let’s take δu as an increment
xi+1 = a.cos(ui+δu)
yi+1 = b.sin(ui+δu) -------------------------(b)
Using the sum of the angles formulae yields
xi+1 = a.(cosui*cosδu - sinui*sinδu)……x(b/b)
yi+1 = b.(cosui*sinδu + sinui*cosδu)…..x(a/a)----(c)
Using Eqn (a) 71
Parametric Representation of an Ellipse
Using Eqn (a)
Recursive Relation:
xi+1 = xi.cosδu – (a/b). yi.sinδu
yi+1 = (b/a).xi.sinδu –yi.cosδu
δu, a & b are constants | 4 multiples | One addition and one
subtraction in inner loop. Algorithm is efficient.
Xi+1, yi+1
xi, yi
72
Need of Algorithm for
Parametric Representation of an Ellipse
73
Model Solution
Generate an ellipse with semi-major axis a=4 and semi-minor axis
b=1, inclined 30o to the horizontal with center at (2,2). Take 32
segments.
No of segments = 32, n = 32. We need n+1 points (starting (θ=0)
and closing point (θ=2π) will coincide).
74
Model Solution
75
Model Solution
Origin centered
# i xi yi
1 0 4.000 0.000
2 ϖ/16 3.923 0.195
3 2ϖ/16 3.696 0.383
4 3ϖ/16 3.326 0.556
5 4ϖ/16 2.828 0.707
6 5ϖ/16 2.222 0.831
7 6ϖ/16 1.531 0.924
8 7ϖ/16 0.780 0.981
9 8ϖ/16 0.000 1.000
76
Model Solution
Center at C(2,2) and Rotation 30o
i Xi yi
1 5.465 4.000
2 5.300 4.131
3 5.009 4.179
4 4.603 4.144
5 4.096 4.027
6 3.509 3.831
7 2.864 3.565
8 2.185 3.240
9 1.500 2.866
77
Tut-1
Find the center, lengths of half the axes and the orientation of an
ellipse defined by it’s circumscribing rectangle
78
Tut-1
Find the center, lengths of half the axes and the orientation of an
ellipse defined by it’s circumscribing rectangle
79
Tut-2
Find the center, lengths of half the axes and the orientation of an
ellipse defined by it’s circumscribing rectangle
80
Tut-3
Correlate to its mathematical foundations: Ellipse inscribing a circle of
Radius R1 and circumscribed by a circle of radius R2.
81
Modeling Analytic Curves
(Parabola)
82
Representation of a Parabola
83
Application of a Parabola
Parabolic solar concentrator
84
Parametric Representation of a Parabola
Non-P Eqn.: y2 = 4 ax
One way of representation:
x = a.tan2Φ
y = ±(2) 1/2.a.tanΦ
P(Φ) = [a.tan2Φ ±2(a.tanΦ)1/2]T
85
Need of Efficient Algorithm
Parametric Representation of a Parabloa
Another way of representation:
x = a.u2 and y = 2.a.u
where, 0 ≤ u ≤ ∞ (u is not an angle).
86
Need of Efficient Algorithm
Parametric Representation of a Parabloa
Recursive Relation:
xi+1 = xi + yδu – a(δu)2
yi+1 = yi+2aδu …………………(d)
89
Various Orientations of Parabola
90
Model Solution
Generate a parabolic segment in the I quadrant for
1≤x≤4 for the parabola given by: x = au2 = u2 and
y = 2au = 2u
The range of x-coordinate is limited. Therefore, let’s
determine limits of u.
umin = (xmin/a)1/2 = (1/1) = 1
umax = (xmax/a)1/2 = (4/1)1/2 = 2
Let n = 10.
δu = (umax – umin)/n–1 = (2–1)/10–1 = 1/9
91
Recursive Relation of a Parabola
First point: u1 = umin =1
Therefore, x1 = (a.u12) = (1.12) = 1
y1 = 2au1 = 2(1)(1) = 2
For successive points, Recursive Relation:
xi+1 = xi + yδu – a(δu)2
yi+1 = yi+2aδu …………………(d)
For 2nd point:
x2 = x1 + y1δu – a(δu)2 = 1+2(1/9)+1(1/9)2 = 1.235
y2 = y1+2aδu = 2+2(1)(1/9) = 2.222
x3 =
y3 =
Once user defines 1st point other points are automatically
92
generated as δu, a are constant.
Model Solution
Successive points are generated
i Xi yi
4
1 1 2
2 1.235 2.222
2
3 1.494 2.444
4 1.778 2.667 1 4
5 2.086 2.889
6 2.420 3.112
7 2.778 3.333
8 3.160 3.556
9 3.568 3.778
10 4.000 4
xi+1 = xi + yδu – a(δu)2 93
94
Representation of a Hyperbola
95
Parametric Representation of a Hyperbola
98
Recursive Relation of a Hyperbola
1st Point:
xi = a.coshui
yi = b.sinhui ……..(a)
Successive points with δu as increments:
δu = (umax – umin)/n–1
1st Point:
xi = a.coshui
yi = b.sinhui ……..(a)
Successive Points:
xi+1 = a.cosh(ui+δu)
= a(coshu.coshδu + sinhu.sinhδu) …. x(b/b)
yi+1 = b.sinh(ui+δu)
= b(sinhu.coshδu + coshu.sinhδu) …. x(a/a)
xi+1 = xi.coshδu + (a/b).yi.sinhδu)
yi+1 = (b/a) xi.sinhδu + yi.coshδu) 100
Model Solution
Generate 8 points on the hyperbolic segments in the I
quadrant for 4≤x≤8 with a=2, b=1.
The range of x-coordinate is limited. Therefore, let’s
determine limits of u.
umin = cosh-1(xmin/a) = 1.317
umax = cosh-1(xmax/a) = 2.063
n = 10.
δu = (umax – umin)/n–1 = (2.063–1.317)/8–1=0.107
101
Model Solution
Successive points are generated
i Xi yi
1 4.000 1.732
2 4.393 1.956
3 4.836 2.201
4 5.334 2.472
5 5.892 2.771
6 6.518 3.102
7 7.218 3.468
8 8.000 3.873
xi+1 = xi.coshδu + (a/b).yi.sinhδu)
yi+1 = (b/a) xi.sinhδu + yi.coshδu)
102
Parametric Equations of Analytic Curves
103