You are on page 1of 45

Geometric modeling

Curves

Computer-aided design
Modeling Analytic Curves
(Circle)

Computer-aided design
Non-Parametric Representation of a Circle
Generate a unit 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

Computer-aided design
Observations of
Non-Parametric Representation of a Circle
❑ Resulting intercepts on arc/circle are unequal
and hence poor visual representation.
❑ Calculation of square root is computationally
expensive.
❑ Calculation has to be repeated for every point.
y = +(1 – x2)1/2
No. x y
1 0 1
2 0.25 0.97
3 0.5 0.87
4 0.75 0.66
5 1 0

Computer-aided design
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.

P-Equation of Circle: x = cosθ and y = sinθ.


P(θ) = [x y]T | P(θ) = [cosθ sinθ] T
θ X Y
0 1 0
π/8 0.92 0.38
π/4 0.71 0.71
3π/8 0.38 0.92
π/2 0 1
Computer-aided design
Observations of
Parametric Representation of a Circle
❑ Resulting intercepts on arc/circle are equal and
hence better visual representation.
❑ Computationally expensive as the calculation of
trigonometric function [x = cosθ and y = sinθ]
has to be repeated for every point.
❑Algorithm is inefficient.

Computer-aided design
We Need an Efficient Algorithm
Parametric Representation of a Circle

Efficient algorithm can be obtained by eliminating


the requirement of repetitive calculations of
trigonometric function [x = cosθ and y = sinθ] for
every point.

Computer-aided design
Need of Efficient Algorithm
Parametric Representation of a Circle

Let’s assume fixed number


of uniformly spaced points

‘δu’ is parameter increment


between points (which is a
constant)

Computer-aided design
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)
Computer-aided design
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)

Computer-aided design
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 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.

Computer-aided design
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’)

xi+1 = xc + (xi*cosδu - yi*sinδu)


yi+1 = yc + (xi*sinδu + yi*cosδu)--(d’)

Computer-aided design
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).

Computer-aided design
Model Solution
Generate a circle of radius 2 with centre (2,2). Take 8 segments.
For a origin centered circle,

Computer-aided design
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

Computer-aided design
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
(a) Passing through corners

P(u) = [RoCosu RoSinu]T

Pc = (P1+P3)/2 = OR = (P2+P4)/2

Xc = (X1+X3)/2 & Yc = (Y1+Y3)/2

Ro = 1/2[(X1 – X3)2 + (Y1 – Y3)2]1/2

Computer-aided design
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

(b) Inscribed in a Square

P(u) = [RiCosu RiSinu]T

Pc = (P1+P3)/2 = OR = (P2+P4)/2

Xc = (X1+X3)/2 & Yc = (Y1+Y3)/2

Ro = 1/2[(X3 – X4)2 + (Y3 – Y4)2]1/2

Computer-aided design
Efficient Algorithm [Tut]
Generate an efficient algorithm to generate a circle which is
concentric to existing circle (Black coloured) shown in Fig.

Ro d Pi(u) = [RiCosu RiSinu]T | Blue one

Po(u) = [RoCosu RoSinu]T | Green one


Ri
d Pc = Given Center Point Pc

Ri = R-d | Ro = R+d

Computer-aided design
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
P = [x y]T | x = R.cos(2πu) & y = R.sin(2πu)

(a) Parametric Equation of circle:


P(u) = [R.Cos(2πu) R.Sin(2πu)]T 0≤u ≤1
(b) Tangent Equation:
P’(u) = [-2πR.Sin(2πu) 2πR.Cos(2πu)]T 0≤u ≤1

(c) At 0o , 2πu = 0, Therefore, u = 0


At 45o, 2πu = 45, Therefore, u = 0.125
At 90o , 2πu = 90, Therefore, u = 0.25
Computer-aided design
General Problem

Computer-aided design
General Problem

Computer-aided design
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.

❑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.

Computer-aided design
Parametric Equation

P(u) = [x y]T = [R.Cosu R.Sinu]T us≤u ≤ ue


Origin Centered

P(u) = [xc + R.Cosu yc + R.Sinu]T us≤u ≤ ue


Non-Origin Centered

Computer-aided design
Parametric Line [Tut]
(a) Find P-equations of 2 lines: L1, L2.
(b) Find intersection point (I) of two lines
(c) Find P-equation of Circle (I is center and radius 1)
(d) Find intersection point (II) L1 and C1.

Computer-aided design
Parametric Line [Tut]

(b)Find intersection point (I) of two lines


(c)Find P-equation of Circle (I is center and radius 1)
(d)Find intersection point (II) L1 and C1.

Computer-aided design
Parametric Line [Tut]

(c)Find P-equation of Circle (I is center and radius 1)


(d)Find intersection point (II) L1 and C1.

Computer-aided design
Parametric Line [Tut]

(c)Find P-equation of Circle (I is center and radius 1)


(d)Find intersection point (II) L1 and C1.

Computer-aided design
Need of Efficient Algorithm (ASSIGNMENT)

(a) for a Circle Passing through 3 Points


(b) for a Circle tangent to two lines with given radius R

Computer-aided design
Modeling Analytic Curves
(Ellipse)

Computer-aided design
Representation of an Ellipse

Database Requirement:

Center, Major axis (2a) and Minor axis (2b)

Computer-aided design
Representation of an Ellipse
Equal Angle Increments Method

Equal angle increment method gives acceptable results (equal


segments) in case of circle, however, unacceptable results (undesired
segments) in case of ellipse.

Computer-aided design
Representation of an Ellipse
Equal segments Method

For a sufficient number of segments this gives a better representation.


However, the ellipse is over specified towards minor axis ends and
underspecified towards major axis ends.

Computer-aided design
Desired Increments Method: More number of points towards ends
of major axis and less number of points towards ends of minor axis

Computer-aided design
Parametric Representation of an Ellipse
Desired Increments Method: More number of points towards ends
of major axis and less number of points towards ends of minor axis
Any point on ellipse: P(u) = [x y]T

Let: xi = acosui
yi = bsinui

dx = -a.sinu.du & dy = b.cosu.du

at u = 0 & π |dx|~ 0 & |dy|~bdu


at u = π/2 & 3π/2 |dx|~ adu & |dy|~0
bdu < adu

This clearly shows that the desired increments can be easily obtained.
Computer-aided design
Recursive Relation of an Ellipse
Xi+1, yi+1
P-Eqn: P(u) = [acosui bsinui]T
xi, yi

xi = acosui
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)

Computer-aided design
Recursive Relation of an Ellipse
Xi+1, yi+1
P-Eqn: P(u) = [acosui bsinui]T
xi, yi

Recursive Relation:
xi+1 = xi.cosδu – (a/b). yi.sinδu
yi+1 = (b/a).xi.sinδu +yi.cosδu 0≤u ≤2π
Δu, a & b are constants | 4 multiples | One addition and one
subtraction in inner loop. Algorithm is efficient.

Computer-aided design
Need of Algorithm for
Parametric Representation of an Ellipse

0≤u ≤2π
Recursive relation

0≤u ≤2π

Computer-aided design
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).

Computer-aided design
Model Solution

Computer-aided design
Model Solution
Origin centered
0≤u ≤2π
# ui 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

Computer-aided design
0≤u ≤2π
Model Center at C(2,2) and Rotation 30o
Center at C(2,2) and Rotation 30o
ui Xi yi
0 5.465 4.000
π/16 5.300 4.131
2π/16 5.009 4.179
3π/16 4.603 4.144
4π/16 4.096 4.027
5π/16 3.509 3.831
6π/16 2.864 3.565
7π/16 2.185 3.240
8π/16 1.500 2.866

Computer-aided design
Tut-1
Find the center, lengths of half the axes and the orientation of an
ellipse defined by it’s circumscribing rectangle

Computer-aided design
Tut-1
Find the center, lengths of half the axes and the orientation of an
ellipse defined by it’s circumscribing rectangle

Computer-aided design
Tut-2
Correlate to its mathematical foundations: Ellipse inscribing a circle of
Radius R2 and circumscribed by a circle of radius R1.

Computer-aided design
THANK YOU !

Computer-aided design

You might also like