Introduction to Computer Graphics
Lecture 9
2D Curves

Don Herbison-Evans
don@it.uts.edu.au

(updated 21 October 2004)

TYPES OF CURVES

  • Circles
  • Polynomials
  • Splines
  • CIRCLES
    Formulations:

  • Implicit: x2 + y2 - r2 = 0
  • Explicit: y = (r2 - x2)1/2
  • Parameterised: x = r.cos(u/2pi)
    y = r.sin(u/2pi)
  • Parameterised allows better conversion to a polygon for drawing.

    POLNOMIALS
    There is a unique polynomial through n points with degree (n-1).
    The easiest formulation for it is due to Lagrange :

    y = SUMI yi.(PRODJ'(x-xj)/PRODJ'(xi-xj)) where :
    SUMI is the sum of terms over all points (xi,yi)
    PRODJ' is the product of all terms except (xi,yi)

    Note that each y value is multiplied by a polynomial that is unity at its own x value and zero at all the other x values.
    Problems as it oscillates to values outside the convex hull of the points.

    SPLINES
    Composed of pieces of low order polynomials, typically cubics.
    Pieces are joined to give continuity of value, slope, and curvature.
    Still formulated so that the value at any point is a sum over some y values, each of which is multiplied by a blending polynomial the values of which sum to unity.
    Normally used in parameterised form:

    x = Bx(u)
    y = By(u)
    The points (xk,yk) are called 'knots'.

    Various sorts of splines:

    Global control & goes through every point :
  • Natural
  • Hermite
  • Cardinal
  • Global control & goes near every point :
  • Bezier
  • Local control & goes near every point :
  • B
  • Periodic B
  • Open Uniform B
  • Non Uniform B
  • Beta
  • Rational
  • NURBS
  • Implement using recursive formulation for x in the interval xk to xk+1 starting with d=4 for a cubic B spline : Bk,d(x) = Bk,d-1.P1 + Bk+1,d-1.P2
    where
    P1 = (x - xk)/(xk+d-1 - xk)
    P2 = (xk+d - x)/(xk+d - xk+1)
    and
    Bk,1 = 1 if xk <= x <= xk+1
    or
    Bk,1 = 0 otherwise