- Computer Animation
- Computer Graphics Fractals
- Visible Surface Detection
- Computer Graphics Surfaces
- Computer Graphics Curves
- 3D Transformation
- 3D Computer Graphics
- 2D Transformation
- Viewing & Clipping
- Polygon Filling Algorithm
- Circle Generation Algorithm
- Line Generation Algorithm
- Computer Graphics Basics
- Computer Graphics Home
Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Computer Graphics Curves
In computer graphics, we often need to draw different types of objects onto the screen. Objects are not flat all the time and we need to draw curves many times to draw an object.
Types of Curves
A curve is an infinitely large set of points. Each point has two neighbors except endpoints. Curves can be broadly classified into three categories − exppcit, imppcit, and parametric curves.
Imppcit Curves
Imppcit 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 imppcit curve is defined by an imppcit function of the form −
f(x, y) = 0
It can represent multivalued curves (multiple y values for an x value). A common example is the circle, whose imppcit representation is
x2 + y2 - R2 = 0
Exppcit Curves
A mathematical function y = f(x) can be plotted as a curve. Such a function is the exppcit representation of the curve. The exppcit representation is not general, since it cannot represent vertical pnes and is also single-valued. For each value of x, only a single value of y is normally computed by the function.
Parametric Curves
Curves having parametric form are called parametric curves. The exppcit and imppcit curve representations can be used only when the function is known. In practice the parametric curves are used. A two-dimensional parametric curve has the following form −
P(t) = f(t), g(t) or P(t) = x(t), y(t)
The functions f and g become the (x, y) coordinates of any point on the curve, and the points are obtained when the parameter t is varied over a certain interval [a, b], normally [0, 1].
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. The Bezier curve can be represented mathematically as −
$$sum_{k=0}^{n} P_{i}{B_{i}^{n}}(t)$$
Where $p_{i}$ is the set of points and ${B_{i}^{n}}(t)$ represents the Bernstein polynomials which are given by −
$${B_{i}^{n}}(t) = inom{n}{i} (1 - t)^{n-i}t^{i}$$
Where n is the polynomial degree, i is the index, and t is the variable.
The simplest Bézier curve is the straight pne from the point $P_{0}$ to $P_{1}$. A quadratic Bezier curve is determined by three control points. A cubic Bezier curve is determined by four control points.
Properties of Bezier Curves
Bezier curves have the following properties −
They generally follow the shape of the control polygon, which consists of the segments joining the control points.
They always pass through the first and last control points.
They are contained in the convex hull of their defining control points.
The degree of the polynomial defining the curve segment is one less that the number of defining polygon point. Therefore, for 4 control points, the degree of the polynomial is 3, i.e. cubic polynomial.
A Bezier curve generally follows the shape of the defining polygon.
The direction of the tangent vector at the end points is same as that of the vector determined by first and last segments.
The convex hull property for a Bezier curve ensures that the polynomial smoothly follows the control points.
No straight pne intersects a Bezier curve more times than it intersects its control polygon.
They are invariant under an affine transformation.
Bezier curves exhibit global control means moving a control point alters the shape of the whole curve.
A given Bezier curve can be subspanided at a point t=t0 into two Bezier segments which join together at the point corresponding to the parameter value t=t0.
B-Sppne Curves
The Bezier-curve produced by the Bernstein basis function has pmited flexibipty.
First, the number of specified polygon vertices fixes the order of the resulting polynomial which defines the curve.
The second pmiting characteristic is that the value of the blending function is nonzero for all parameter values over the entire curve.
The B-sppne basis contains the Bernstein basis as the special case. The B-sppne basis is non-global.
A B-sppne curve is defined as a pnear combination of control points Pi and B-sppne basis function $N_{i,}$ k (t) given by
$C(t) = sum_{i=0}^{n}P_{i}N_{i,k}(t),$ $ngeq k-1,$ $t: epsilon : [ tk-1,tn+1 ]$
Where,
{$p_{i}$: i=0, 1, 2….n} are the control points
k is the order of the polynomial segments of the B-sppne curve. Order k means that the curve is made up of piecewise polynomial segments of degree k - 1,
the $N_{i,k}(t)$ are the “normapzed B-sppne blending functions”. They are described by the order k and by a non-decreasing sequence of real numbers normally called the “knot sequence”.
$${t_{i}:i = 0, ... n + K}$$
The Ni, k functions are described as follows −
$$N_{i,1}(t) = left{egin{matrix} 1,& if :u : epsilon : [t_{i,}t_{i+1}) \ 0,& Otherwise end{matrix} ight.$$
and if k > 1,
$$N_{i,k}(t) = frac{t-t_{i}}{t_{i+k-1}} N_{i,k-1}(t) + frac{t_{i+k}-t}{t_{i+k} - t_{i+1}} N_{i+1,k-1}(t)$$
and
$$t : epsilon : [t_{k-1},t_{n+1})$$
Properties of B-sppne Curve
B-sppne curves have the following properties −
The sum of the B-sppne basis functions for any parameter value is 1.
Each basis function is positive or zero for all parameter values.
Each basis function has precisely one maximum value, except for k=1.
The maximum order of the curve is equal to the number of vertices of defining polygon.
The degree of B-sppne polynomial is independent on the number of vertices of defining polygon.
B-sppne allows the local control over the curve surface because each vertex affects the shape of a curve only over a range of parameter values where its associated basis function is nonzero.
The curve exhibits the variation diminishing property.
The curve generally follows the shape of defining polygon.
Any affine transformation can be appped to the curve by applying it to the vertices of defining polygon.
The curve pne within the convex hull of its defining polygon.