Open In App

Computer Graphics Curve in Computer Graphics

Improve
Improve
Like Article
Like
Save
Share
Report

In computer graphics, we often need to draw different types of objects onto the screen. Objects are not flat all time and we need to draw curves many times to draw an object.

Types of Curves:

The curve is an infinitely large set of points. Each point has two neighbors except endpoints.

  1. Implicit curves
  2. Explicit curves
  3. Parametric curves
  4. Bezier curves
  5. B-spline curves

Implicit Curves:

An implicit curve or surface is the set of zeros of a function of 2 or 3 variables. We use implicit curve functions to define lines and planes. Provides no control over tangents at connection points when joining several implicit functions. Implicit functions are hard to find for many shapes. Use a function that states which points are on and off the curves. 

Circle

 

All lines: Ax+By+C=0 

In three dimensions f(X,Y, Z) defines a surface.

  • Any plane Ax+By+ +D=0, with constants a,b,c, and d.
  • A sphere centered at the origin with a radius: r: x^2+y^2+Z^2-R^2=0

Curves in 3D are not so easily represented in implicit form. In general, we cannot solve for points that satisfy the implicit form.

  • Implicit function form – f(x,y) = 0                                                                                                                                                                              
  • The implicit representation for the circle is:  X^2+Y^2-R^2=0 

Explicit curves:

  • Do not allow for multiple values for a given argument
  • Cannot describe vertical tangents, as infinite slopes are hard to represent.
  • Cannot represent all curves (vertical lines, circles)

Gives the value of one variable, the dependent variable in other terms of the other the independent variable. The most familiar form of the curve in 2D:  Y= f(x)

Where y is the dependent variable, and x is the independent variable. 

curves Z = f(x), surfaces Z = f(x,y)

Mathematical function: 

f = y(x) can be plotted on curve  

eg: y = 2X^5+3X^4                                                                                                                                                                                                            

y=mx+c

Parametric curves:

Curves have a parametric form called parametric curves. A curve in the plane is said to be parameterized if the set of coordinates on the curves (x,y,z) is represented as a function of a variable t. The variable t is called a parameter and the relations between x,y,z, and t are called a parametric equation

Y^2=4ab         p(t)=f(t), g(t) or p(t) = x(t), y(t)

The parametric form of a curve is a function that assigns a position to values of the free parameters. That the parametric function is a vector-valued function. This example is a 2D curve, so the output of the function is a 2-D vector, in 3D it would be a 3 vector. It is simple and flexible

The parametric form is suitable for representing closed and multivalued curves. In parametric curves, each coordinate of a point on a curve is represented as a function of a single parameter. There are many curves that we cannot write down as a single equation in terms of x and y. The position vector of a point on the curve is fixed by the value of the parameter. Since a point on a parametric curve is specified by a single value of the parameter, the parametric form is axis-dependent. The function of each coordinate can be defined independently 

(X(t), Y(t)) :1D curve in 2D curve (X(t), Y(t), Z(t)) :1D curve in 3D space

Eg: x=acost; y=asint

Bezier curves:

A bezier curve is particularly a kind of spline generated from a set of control points by forming a set of polynomial functions. Discovered by the french engineer Pierre bezier. These functions are computed from the coordinates of the control points. These curves can be generated under the control of other points. Tangents by using control points are used to generate curves.

It is an approximate spline curve. A bezier curve is defined by the defining polygon. It has no properties that make them highly useful and convenient for curve and surface design.

Summation of k from 0 to n PiBi^n(t), Bi^n(t) = (n i)*(1-t)^n-i*t^i

Different types of curves are Simple, Quadratic, and Cubic.

  1. Simple curve: Simple bezier curve is a straight line from the point. 

Simple 

      2. Quadratic curve: Quadratic bezier curve is determined by three control points.

Quadratic

    3. Cubic curve: The cubic bezier curve is determined by four control points.

cubic

Properties of Bezier Curve:

  1. Bezier curves are widely available and used in various CAD systems, in general graphics packages such as GL
  2. The slope at beginning of the curve is along the line joining the first two control points and the slope at the end of the curve is along the line joining the last two points 
  3. Bezier curve always passes through the first and last points i.e p(o)=po, p(1,=pnlie)
  4. The curves lies entirely within the convex hall formed by the four control points
  5. The slope at the beginning of the curve is along the line joining the first two control points and the slope at the end of the curve is along the line joining the last two points.
  6. The degree of polynomial defining the curve segment is one less than the no of defining the polygon.

Bezier Curve for 3 Points:

Q(u)=PoBo12(u)+P1B1,2(u)+P2B2,2(u)

  • B0,2(u)=2Co*+u^0(1-u)*^2-0

             = (1-U)^2

  • B1,2(u)=2C1*U^1(1-u)*^2-1

            = 2u(1-u)

  • B2,2(u)=2C2*U^2(1-u)*^2-2

            =u^2

Q(u)=P0(1-u)^2+P1*2u(1-u)+P2U^2

X(u)=(1-u)^2*X0+2U*(1-u)*X1+u^2*x2

Y(u)=(1-u)^2*y0+2u*(1-u)*y1

  • Bezier curves exhibit global control points means moving control points alert the shape of the whole curve.

Different varieties of spline curves are used in graphics applications.

  1. Hermit spline
  2. Relaxed end spline
  3. Cyclic spline
  4. Anti cyclic spline
  5. Normalized spline

B-spline curves:

the sum of the b-spline basic function at any parametric ‘u’ equal to 1 

Summation of i from 1 to n+1 nik(u)=1          
n+1= no of control points; 
k=order of b-spline curve

We can add/modify any no of control points to change the shape of the curve without affecting the degree of polynomial .Control points affect the shape of the curve only over range of parameter values where is associated basic function is non-zero. The polynomial curve has degree (d-1) and C^d-2 continuity over the range of u. Where each blending function is defined our d sub intervals of the total range of u. The selected set of subintervals endpoints u is referred to as a knot vector. The basic function is positive or zeroes for all parameter values. Expect for k=1 each basis function has one maximum value.



Last Updated : 18 Apr, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads