0-CubicSpline-Bezier - Curve-25oct18
0-CubicSpline-Bezier - Curve-25oct18
of 2D Entities (Curves)
Content
• Curve Representation-
Parametric vs Non-Parametric
• Types of Curves-
Analytic, Synthetic
• Analytic Curves:
Line, Circle, Ellipse, Parabola, Hyperbola
• Synthetic (Free) Curves:
Cubic Spline, Bezier, B-Spline, NURBS
Representation of curve
• Curves (2D Entities) are important entities in Geometric
modeling
In Scalar Form
Tangents
• The derivative of a curve represents the tangent
vector to the curve at some point
dx
u
du
xu
Parametric Representation of line
Tangent Vector of Line P1, P2 is
P’ = P2 – P1
In Scalar Form
^ P2- P1 P2- P1
n = -------------- = ---------- where L = Sqrt(dX2 + dY2 +dZ2)
| P2-P1| L
^ X’ Y’ Z’
n = ---- i + ----- j + ----- k
L L L
Parametric Representation of line
Cross product of vectors
Cross product of vectors
Dot Product of vectors
Parametric Representation of line
Parametric Representation of line
P = P1 + L ^n
x= 𝑥1 + 𝐿.l
y= y1+ L.m
z= z1 + L.n
where L = Sqrt(dX2 + dY2 +dZ2)
0<L<Lmax
^ X’ Y’ Z’ ^
n = ---- i + ----- j + ----- k n= l i+ mj+ nk
L L L
Parametric Representation
of Circle
Parametric Representation of Circle
Parametric Equation of Circle
Cartesian Cylindrical
radius=10 radius=10
x=radius*cos(t*360) r = radius
y=radius*sin(t*360) theta = t *360
z=0 z=0
Spherical
radius=10
rho = radius
theta =90
phi = 360*t
Circle with centre (Xc,Yc,Zc)
X = Xc + R Cos (2 u) ,
Y = Yc+ R Sin (2 u)
Z=Zc for 0 u 1
Recursive Method
(Efficient Algorithm to Generate Circle ):
xi Xc R.Cos( i ) yi Yc R.Sin( i ) Zi =Zc
When eccentricity
< 1 Ellipse
=1 Parabola
>1 Hyperbola
Conic Sections
Applications of Ellipse
WHISPERING GALLERIES
Vijapur Gol ghumat
In rooms where the ceilings are
elliptical, a sound made at one
focus can be heard very clearly at
the other focus.
Any sound made at the focus will
rebound of the elliptical ceiling
and pass through the other focus.
Efficient Algorithm
Conic Sections- Ellipse
Example- Generate quarter part of an ellipse with semi major axis a= 10 and semi
minor axis b=5 inclined 30 degree to the horizontal with center at (5,0) by using
efficient algorithm and represent graphically. Take 33 number of points (n) on the
circumference of an ellipse.
steps:
1. Generate origin centered ellipse with a=10 and b=5
2. Rotate ellipse through 30 degree and then translate the ellipse 5 units in x direction.
a/b= 10/5 =2
x1=10 x 1 = 10
y1 = 5 x 0 = 0
X
X
x2= -4by
x = (40 * t^2)
y = (2*40 * t)
z=0
Applications of Parabola
1. The shape of car headlights, mirrors in reflecting telescopes and television
and radio antennae
Applications of Parabola
1. The shape of car headlights,
The principle used for the car headlight is
also used for torches etc. The light is
placed in the focus of a parabolic mirror, as
the light travels and meets the mirror, it is
reflected in lines parallel to the axis (in
straight lines ) as can be seen in the
diagram to the left. This is why the light
beam from the headlights of cars and from
torches is so strong.
When eccentricity
>1 Hyperbola
Applications of Hyperbola
Above eqn. does not cover maximum plot area. Therefore we use following another
parametric equation which yields the polygon with maximum inscribed area.-
Conic Sections- Hyperbola
OR
Conic Sections- Hyperbola
Similarly other points on the hyperbola in the first quadrant are calculated and
drawn on the graph as bellow
Example Hyperbola
Write the equation for the following hyperbola in both parametric forms:
The second form has two parts, one for the right side and one for the left side.The form for the right side is:
The equation given is the parametric equation for the right half of a hyperbola. The
equation for the left half is of the form:
Spiral curve
Cartesian Cylindrical
radius=10 radius=10
pitch=10 pitch=10
height=50 height=50
x= radius*cos(t*360*pitch) r =radius
y= radius*sin(t*360*pitch) theta = t *360*pitch
z=height*t z = height*t
Sine Curve
* Cartesian coordinates
amplitude=10
wavelength=50
x = wavelength* t
y = amplitude* sin (t * 360)
Spherical Spring
Spherical
pitch=20
radius=10
rho = radius
theta = 180*t
phi = t * 360*pitch
Spherical
pitch=20
radius=10
rho = radius
theta = 90*t
phi = t * 360*pitch
An involute Curve
An involute of a circle is formed as follows:
Imagine that a long (that is, infinite) string is
wound tightly around a circle, and that you
grasp the end of the string and begin to unwind
it, keeping the string taut. The end of the string
traces out the involute.
/* Involute Curve
a=4
nt=2
x =a*(cos(360*t*nt) + t* sin(360*t*nt))
y = a*(sin(360*t*nt) - t *cos(360*t*nt))
z=0
Cycloid
The curve traced out by a point P on the circumference of a circle as
the circle rolls along a straight line is called a cycloid
If the circle has radius r and rolls along the x-axis and if one position of P is
the origin, We find parametric equations for the cycloid.
One arch of the cycloid comes from one rotation of the circle and so is described by
Types of Cycloids
Hyper-cycloid ( Epicycloids ) Hypo-cycloid
A plane curve created by tracing a obtained similarly except
chosen point on the edge of a circle that the circle of radius
of radius r rolling on the outside of a r rolls on the inside of the
circle of radius R. circle of radius R
r
R
Types of Cycloids
Hyper-cycloid ( Epicycloids ) Hypo-cycloid
A plane curve created by tracing a obtained similarly except
chosen point on the edge of a circle that the circle of radius
of radius r rolling on the outside of a r rolls on the inside of the
circle of radius R. circle of radius R
Source: http://www-history.mcs.st-and.ac.uk/Curves/Cycloid.html
Hyper-cycloid
A wheel of radius r=1 rolls around the
outside of a circle of radius or=3. A
point on the rim of the wheel traces
out a curve called a hypercycloid
x=(or+r)*cos(t*360) - cos((or+r)*t*360)
y=(or+r)*sin(t*360) - sin((or+r)*t*360)
z=0
Hyper-cycloid- r=1 Constant & vary or
/* radius of roller
r=1
/* Outside radius of circle on which roller rolls or = 3
or = 3 r=1
(3,0)
x=(or+r)*cos(t*360) - cos((or+r)*t*360) no. of petals=3
y=(or+r)*sin(t*360) - sin((or+r)*t*360)
z=0
no. of petals =4
or = 6
or = 4 r=1
r=1 no. of petals=6
Hyper-cycloid- or=3 Constant & vary r
/* radius of roller
r=1
r=1
or = 3
/* Outside radius of circle on which roller rolls
or = 3 (3,0)
no. of petals=3
x=(or+r)*cos(t*360) - cos((or+r)*t*360)
y=(or+r)*sin(t*360) - sin((or+r)*t*360)
z=0
no. of petals=4
r=2 no. of petals=5
or = 3 r=3
or = 3
Hypo-cycloid
A wheel of radius r=1 rolls around the
inside of a circle of radius or=3. A point P
on the rim of the wheel traces out a P
curve called a hypocycloid
Assuming P starts at the point (3,0)
Parametric Equation:
/* HypoCycloid
/* radius of roller
r=1
x=(or-r)*cos(t*360) + cos((or-r)*t*360)
y=(or-r)*sin(t*360) - sin((or-r)*t*360)
z=0
Hypo-cycloid- or vary & r=1 constant
/* HypoCycloid
/* radius of roller
r=1 Or = 3
x=(or-r)*cos(t*360) + cos((or-r)*t*360)
y=(or-r)*sin(t*360) - sin((or-r)*t*360)
z=0
Or = 4
Or = 6
Hypo-cycloid- r vary & or=3 constant
/* HypoCycloid
/* radius of roller r=1
r=1 Or = 3
x=(or-r)*cos(t*360) + cos((or-r)*t*360)
y=(or-r)*sin(t*360) - sin((or-r)*t*360)
z=0
r=4 r=5
r=2
Or = 3 Or = 3
Or = 3
Examples
Synthetic (Free) Curves
Synthetic curves are also called free curves, since they can be designed and
manipulated, as we desire.
Useful to design complicated & Intricate shaped parts such as car bodies, aeroplane
wings, ship hull, blades, bottles shape, micro fintubes and biomedical applications etc.
Synthetic (Free) Curves
Synthetic (Free) Curves
Synthetic (Free) Curves characteristics
Axis independence: The shape of image should not change when the control points
are measured in a different coordinate system
Local and Global If part of curve shape changes only in the region near the control
points, then behavior is called local control (Figure b). Whereas in global control, curve
shape changes throughout by changing the control point position (Figure a).
Figure a Figure b
Flexibility- Synthetic curves provides very flexibility during the modification by just
adding or removing control points.
If a curve is specified only two control points, we may
get a straight line (fig.a) but by introducing third point we
may get many curves whose shapes depends upon the
position of the third control point as shown in fig(b)
Synthetic (Free) Curves characteristics
The order of a curve deals with the number of degrees of freedom that are necessary to uniquely
define that curve. In general the order of a curve equals the degrees of freedom of that curve.
Degree = (Order - 1)
• Quadratic: f t at bt c
2
• Cubic: f t at 3 bt 2 ct d
Synthetic (Free) Curves characteristics
C0 - Zero order continuity means two curves meet which forms sharp corner at the joint.
C1 First order continuity , both curves are tangent at the point of intersection i.e. tangent at the
end point of first curve (C1) and tangent at the start point of the second curve (C1) is same.
C2 - Second order continuity requires the curvature to be same i.e. radius of curvature at the
end point of first curve (C1) and start point of the second curve (C2) is same.
C1 R R
C1
Second-order parametric
The directions of the tangent vectors
Two curve segments join continuity: C2 parametric
(not necessarily the magnitudes) are
together: C0 geometric equal: C1 geometric continuity. continuity.
continuity. Both the directions and magnitudes
are equal: C1 parametric continuity.
Specifying Curves
• Control Points • Knots
control points that lie on the a set of points that influence the
curve curve's shape
Why cubic?
lower-degree polynomials give too little flexibility
in controlling the shape of the curve
This Curve utilizes a cubic equation therefore 4 conditions are required to determine
Hermite Cubic Spline Curve:
.
-a3
Cubic Spline Curves
Drawbacks
•Due to its global control characteristics, by changing the position of a data point,
the entire shape of spline changes.
•Practically the direction and magnitude of the tangent vector is very difficult to kno
Bezier Curve
Bezier curves and surfaces are developed by P. Bezier of French Car firm
Regie Renault in 1962. He used this curve in UNISURF software to define the
outer panels of several cars.
These data points form the vertices of Bezier polygon which define curve
shape and curve only passes through two end points, other data points
control shape, order of the curve.
p2
p1
p3
p0
This curve is always tangent to first and last segments of the polygon
Bezier Curve
Bezier Curve
Where P(u) is any point on the curve, Pi is control point and Bi,n is Bernstein blending function.
2!
B0,2(u) = -------- u0 (1 – u )2 = (1 – u ) 2
2!
2!
B1,2(u) = -------- u1 (1 – u ) = 2 u (1 – u )
1!
2!
B2,2(u) = -------- u2 (1 – u ) 0 = u 2
2!
P(u) = (1-u)2 P0 + 2u. (1-u) P1 +u2 P2
Pascal’s Triangle for Higher Degree Curves:
We have seen in earlier part that for Cubic Bezier curve n =3 therefore
P(u) = P0 (1 – u )3 + 3 P1 u (1 – u )2 + 3 P2 u2 (1 – u ) + P3 u 3
This way we can continue to add as many rows as we wish to build up the
triangle. First six rows of Pascal’s triangle are shown below: