You are on page 1of 44

CURVES AND SURFACES

UNIT-4
By :
Sandeep Kumar
AP CSE Department
QUADRIC SURFACES
A frequently used class of objects are the quadric surfaces, which are described
with second-degree equations (quadratics). They include spheres, ellipsoids, tori,
paraboloids, and hyperboloids. Quadric surfaces, particularly spheres and
ellipsoids, are common elements of graphics scenes, and they are often available
in graphics packages as primitives from which more complex objects can be
constructed.
Sphere
In Cartesian coordinates, a spherical surface with radius r centered on the
coordinate origin is defined as the set of points (x, y, z) that satisfy the equation

x2+y2+z2 = r2

We can also describe the spherical surface in parametric form, using latitude and
longitude angles
Blobby objects
Some objects do not maintain a fixed shape, but change their surface
characteristics in certain motions or when in proximity to other objects.

Examples in this class of objects include molecular structures, water droplets and
other liquid effects, melting objects, and muscle shapes in the human body. These
objects can be described as exhibiting "blobbiness" and are often simply referred
to as blobby objects, since their shapes show a certain degree of fluidity.
Blobby objects
Several models have been developed for representing blobby objects as
distribution functions over a region of space known as surface functions. A
surface function is defined as

f(x,y,z) = ∑k bk*exp(-ak*r2k) - T =0

where r2k=√(x2+y2+z2), parameter T is some specified threshold, and parameters


a and b are used to adjust the amount of blobbiness of the individual object.
Negative values for parameter b can be used to produce dents instead of bumps.
Blobby objects
Other methods for generating blobby objects use density functions that fall off to
0 in a finite interval, rather than exponentially. The "metaball" model describes
composite objects as combinations of quadratic density functions of the form

And the "soft object" model uses the function


SPLINE
A spline is a flexible strip used to produce a smooth
curve through a designated set of points. Several
small weights are distributed along the length of the
strip to hold it in position on the drafting table as the
curve is drawn.

Spline can mathematically described as a curve with a


piecewise cubic polynomial function whose first and
second derivatives are continuous across the various
curve section
Control Points
We specify a spline curve by giving a set of
coordinate positions, called control points or
data points, which indicates the general
shape of the curve. These control points are
then fitted with piecewise continuous
parametric polynomial functions.

The way of fitting of these control points


divide the spline into two categories

1. Interpolated spline curve


2. Approximated spline curve
Interpolation and Approximation Curve
1. Interpolated spline curve: When polynomial
sections are fitted so that the curve passes
through each control point, then the resulting Interpolated curve

curve is said to interpolate spline curve for


the set of control points.
2. Approximated spline curve: when the
polynomials are fitted to the general control-
point path without necessarily passing
through any control point, the resulting curve
is said to approximate the set of control Approximated curve

points
Convex Hull
The convex polygon boundary that encloses
a set of control points is called the convex
hull.

One way to envision the shape of a convex


hull is to imagine a rubber band stretched
around the positions of the control points so
that each control point is either on the
perimeter of the hull or inside it. Convex
hulls provide a measure for the deviation of
a curve or surface from the region bounding
the control points.
Control Graph
A polyline connecting the sequence of control
points for an approximation spline is usually
displayed to remind a designer of the control-
point ordering. This set of connected line
segments is often referred to as the control
graph of the curve.

Other names for the series of straight-line


sections connecting the control points in the
order specified are control polygon and
characteristic polygon
Piecewise cubic splines
A curve is an infinitely large set of points.
Each point has two neighbors except
endpoints. Curves can be broadly classified
into three categories −

● explicit,
● Implicit,
● parametric curves
Implicit Curves
Implicit curve representations define the set of points on a curve by employing a
procedure that can test to see if a point in on the curve. Usually, an implicit curve
is defined by an implicit function of the form −
f(x, y) = 0
A common example is the circle, whose implicit representation is
x2 + y2 - r2 = 0

Explicit Curves
A mathematical function y = f(x) can be plotted as a curve. Such a function is the
explicit representation of the curve.
Parametric curve
● The explicit and implicit curve representations can be used only when the
function is known.
● Curves having parametric form are called parametric curves.
● In practice the parametric curves are used.
● Every point on the curve is having two neighbors (other than the end points).
● A two-dimensional parametric curve has the following form −

P(u) = f(u), g(u) or P(u) = x(u), y(u)

● The functions f and g become the (x, y) coordinates of any point on the curve,
and the points are obtained when the parameter u is varied over a certain
interval [a, b], normally [0, 1].
Parametric Continuity Conditions
To ensure a smooth transition from one section of a piecewise parametric curve
to the next, we can impose various continuity conditions at the connection points.
If each section of a spline is described with a set of parametric coordinate
functions of the form

we set parametric continuity by matching the parametric derivatives of adjoining


curve sections at their common boundary.
Parametric Continuity Conditions
Three types of continuity

1. Zero Order Continuity


2. First Order Continuity
3. Second Order Continuity
Zero-order parametric continuity (C0)
Zero-order parametric continuity, described as C0
continuity, means simply that the curves meet. That is,
the values of x, y, and z evaluated at u, for the first curve
section are equal, respectively, to the values of x, y, and z
evaluated at u, for the next curve section.
Two pieces of curve must meet at transition point
● Segments have to match ‘nicely’.
● Given two segments P(u) and Q(v).
● We consider the transition of P(1) to Q(0).
● Zero-order parametric continuity
● C0 : P(1) = Q(0).
● Endpoint of P(u) coincides with start point Q(v).
First-order parametric continuity (C1)
First-order parametric continuity, referred to as C1 continuity, means that the first
parametric derivatives (tangent lines) of the coordinate functions for two
successive curve sections are equal at their joining point.

● Segments have to match ‘nicely’.


● Given two segments P(u) and Q(v).
● We consider the transition of P(1) to Q(0).
● First order parametric continuity
● C1: dP(1)/du = dQ(0)/dv.
● Direction of P(1) coincides with direction of Q(0).
Second-order parametric continuity (C2)
Second-order parametric continuity, or C 2 continuity, means that both the first and
second parametric derivatives of the two curve sections are the same at the
intersection.

● Given two segments P(u) and Q(v).


● We consider the transition of P(1) to Q(0).
● Second order parametric continuity
● C2 : d2P(1)/du2 = d2Q(0)/dv2.
● Curvatures in P(1) and Q(0) are equal.
Geometric Continuity Conditions
An alternate method for joining two successive curve sections is to specify
conditions for geometric continuity. In this case, we only require parametric
derivatives of the two sections to be proportional to each other at their common
boundary instead of equal to each other.

Zero-order geometric continuity (G0 )


Zero-order geometric continuity, described as G0 continuity is the same as zero-
order parametric continuity. That is, the two curves sections must have the same
coordinate position at the boundary point.
First-order geometric continuity (G1)
First-order geometric continuity, or G1 continuity, means that the parametric first
derivatives are proportional at the intersection of two successive sections. If we
denote the parametric position on the curve as P(u) , the direction of the tangent
vector P'(u), but not necessarily its magnitude, will be the same for two successive
curve sections at their joining point under G1 continuity.

Second-order geometric continuity (G2)


Second-order geometric continuity, or G2 continuity. means that both the first and
second parametric derivatives of the two curve sections are proportional at their
boundary. Under G2 continuity, curvatures of two curve sections will match at the
joining position.
Spline Specifications
There are three equivalent methods for specifying a particular spline
representation:

1. We can state the set of boundary conditions that are imposed on the spline.
2. we can state the matrix that characterizes the spline
3. we can state the set of blending functions (or basis functions)

Suppose we have the following parametric cubic polynomial representation for the
x coordinate along the path of a spline section:
Boundary Conditions
● Boundary conditions for this curve might be set,
● for example, on the endpoint coordinates x(0) and x(1) and on the parametric
first derivatives at the endpoints x'(0) and x'(1) .
● These four boundary conditions are sufficient to determine the values of the
four coefficients ax, bx, cx, and dx.

From the boundary conditions, we can obtain the matrix that characterizes this
spline curve by first rewriting the equation
as the matrix product
Boundary Conditions
Matrix Form
we can obtain the matrix that characterizes this spline curve by first rewriting
equation as the matrix product
Blending Functions
BEZIER CURVES
● Bezier curve is discovered by the French engineer Pierre Bézier.
● These curves can be generated under the control of other points.
● Approximate tangents by using control points are used to generate curve.
BEZIER CURVES
A Bezier curve section can be fitted to any number of control points. The number
of control points to be approximated and their relative position determine the
degree of the Bezier polynomial. As with the interpolation splines, a Bezier curve
can be specified with boundary conditions, with a characterizing matrix, or with
blending functions. For general Bezier curves, the blending-function specification
is the most convenient.
BEZIER CURVES...
● Bezier curve is defined by a set of control points b0, b1, b2 and b3.
● Points b0 and b3 are ends of the curve.
● Points b1 and b2 determine the shape of the curve.
BEZIER CURVES...
Bezier Curve Properties:
1. Bezier curve is always contained within a polygon called as convex hull of its
control points.
2. The first and last points of the curve are coincident with the first and last
points of the defining polygon.
3. The degree of the polynomial defining the curve segment is one less than the
total number of control points. (Degree = Number of Control Points – 1)
BEZIER CURVES...
Bezier Curve Equation-
● t is any parameter where 0 <= t <= 1
● P(t) = Any point lying on the bezier curve
● Bi = ith control point of the bezier curve
● n = degree of the curve
● Jn,i(t) = Blending function = C(n,i)ti(1-t)n-i where C(n,i) = n! / i!(n-i)!

Cubic Bezier Curve-


● Cubic bezier curve is a bezier curve with degree 3.
● The total number of control points in a cubic bezier curve is 4.
BEZIER CURVES...
Expanding the Bezier Curve equation, we get-
P (t) = B0J3,0(t) + B1J3,1(t) + B2J3,2(t) + B3J3,3(t)

Using (2), (3), (4) and (5) in (1), we get-

P(t) = B0(1-t)3 + B13t(1-t)2 + B23t2(1-t) + B3t3


(parametric equation for a cubic bezier curve)
 
BEZIER CURVES...
Applications of Bezier Curves-
Computer Graphics: To model & manipulates smooth curves.
Animation: Outline movement in animation applications such as Adobe Flash,
creates the needed frames for the object to move along the path, 3D
animation, bezier curves are often used to define 3D paths as well as 2D
curves.
Fonts: True type fonts use composite bezier curves composed of quadratic
bezier curves.
BEZIER CURVES...
Example: Given a bezier curve with 4 control points: B0[1 0] , B1[3 3] , B2[6 3] , B3[8 1]
Determine any 5 points lying on the curve. Also, draw a rough sketch of the curve.
Solution:
Parametric equation for a cubic bezier curve is:
P(t) = B0(1-t)3 + B13t(1-t)2 + B23t2(1-t) + B3t3
Substituting the control points B0, B1, B2 and B3, we get-
P(t) = [1 0](1-t)3 + [3 3]3t(1-t)2 + [6 3]3t2(1-t) + [8 1]t3      
Now assume any 5 values of t lying in the range 0 <= t <= 1.
Like: 0, 0.2, 0.5, 0.7, 1
BEZIER CURVES...
For t = 0:
● Substituting t=0 in (1), we get-
● P(0) = [1 0](1-0)3 + [3 3]3(0)(1-t)2 + [6 3]3(0)2(1-0) + [8 1](0)3
● P(0) = [1 0] + 0 + 0 + 0
● P(0) = [1 0]
BEZIER CURVES...
For t = 0.2:
● Substituting t=0.2 in (1), we get-
● P(0.2) = [1 0](1-0.2)3 + [3 3]3(0.2)(1-0.2)2 + [6 3]3(0.2)2(1-0.2) + [8 1](0.2)3
● P(0.2) = [1 0](0.8)3 + [3 3]3(0.2)(0.8)2 + [6 3]3(0.2)2(0.8) + [8 1](0.2)3
● P(0.2) = [1 0] x 0.512 + [3 3] x 3 x 0.2 x 0.64 + [6 3] x 3 x 0.04 x 0.8 + [8 1] x
0.008
● P(0.2) = [1 0] x 0.512 + [3 3] x 0.384 + [6 3] x 0.096 + [8 1] x 0.008
● P(0.2) = [0.512 0] + [1.152 1.152] + [0.576 0.288] + [0.064 0.008]
● P(0.2) = [2.304 1.448]
BEZIER CURVES...
● For t = 0.5:
● Substituting t=0.5 in (1), we get-
● P(0.5) = [1 0](1-0.5)3 + [3 3]3(0.5)(1-0.5)2 + [6 3]3(0.5)2(1-0.5) + [8 1](0.5)3
● P(0.5) = [1 0](0.5)3 + [3 3]3(0.5)(0.5)2 + [6 3]3(0.5)2(0.5) + [8 1](0.5)3
● P(0.5) = [1 0] x 0.125 + [3 3] x 3 x 0.5 x 0.25 + [6 3] x 3 x 0.25 x 0.5 + [8 1] x
0.125
● P(0.5) = [1 0] x 0.125 + [3 3] x 0.375 + [6 3] x 0.375 + [8 1] x 0.125
● P(0.5) = [0.125 0] + [1.125 1.125] + [2.25 1.125] + [1 0.125]
● P(0.5) = [4.5 2.375]
BEZIER CURVES...
For t = 0.7:
● Substituting t=0.7 in (1), we get-
● P(t) = [1 0](1-t)3 + [3 3]3t(1-t)2 + [6 3]3t2(1-t) + [8 1]t3
● P(0.7) = [1 0](1-0.7)3 + [3 3]3(0.7)(1-0.7)2 + [6 3]3(0.7)2(1-0.7) + [8 1](0.7)3
● P(0.7) = [1 0](0.3)3 + [3 3]3(0.7)(0.3)2 + [6 3]3(0.7)2(0.3) + [8 1](0.7)3
● P(0.7) = [1 0] x 0.027 + [3 3] x 3 x 0.7 x 0.09 + [6 3] x 3 x 0.49 x 0.3 + [8 1] x
0.343
● P(0.7) = [1 0] x 0.027 + [3 3] x 0.189 + [6 3] x 0.441 + [8 1] x 0.343
● P(0.7) = [0.027 0] + [0.567 0.567] + [2.646 1.323] + [2.744 0.343]
● P(0.7) = [5.984 2.233]
BEZIER CURVES...
For t = 1:
● Substituting t=1 in (1), we get-
● P(1) = [1 0](1-1)3 + [3 3]3(1)(1-1)2 + [6 3]3(1)2(1-1) + [8 1](1)3
● P(1) = [1 0] x 0 + [3 3] x 3 x 1 x 0 + [6 3] x 3 x 1 x 0 + [8 1] x 1
● P(1) = 0 + 0 + 0 + [8 1]
● P(1) = [8 1]
BEZIER CURVES...
BEZIER CURVES
Suppose we are given n + 1 control-point positions: pk = (xk, yk, zk), with k varying
from 0 to n. These coordinate points can be blended to produce the following
position vector P(u), which describes the path of an approximating Bezier
polynomial function between p0 and pn

The Bezier blending functions BEZk,n(u) are the Bernstein polynomials:

where the C(n, k) are the binomial coefficients:

You might also like