- Forward


Scientific Visualization and Animation using Bezier Curves
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu

Print

Overview
Back SMYC Forward
  • Advantages of Bezier Curves:
    • Derivative information is not required
    • Users can have an intuitive feel
  • Properties of Bezier Curves:
    • Only the first and last vertices lie on the curve
Mathematical Representation
Back SMYC Forward
  • The Binomial Coefficient (\(n\) choose \(i\)):
    • \(\binom{n}{i} = \frac{n!}{i!(n-i)!}\)
  • The Basis Function:
    • \(J_{n,i}(t) = \binom{n}{i} t^i (1-t)^{n-1}\)
    • where \(n\) is the degree of the polynomial and \(i\) is the vertex index (in \([0,n]\))
  • Points on the Curve:
    • \(P(t) = \sum_{i=0}^{n} P_i J_{n,i}(t)\) for \(t \in [0,1]\)
    • where \(P_i\) is the vector containing the coordinates of vertex \(i\)
Bezier Curves in OpenGL
Back SMYC Forward
  • Evaluators:
    • Compute the values for Bernstein polynomials of any order
  • Types:
    • Points/vertices are the most common (e.g., GL_MAP1_VERTEX_3)
    • Can also be used for colors, normals, and textures
    • Must be enabled using glEnable() (e.g., glEnable(GL_MAP1_VERTEX_3))
  • Arguments:
    • umin and umax define the range of the parameter (usually 0 and 1)
    • stride is the number of values of the parameter between curve segments
    • order is the order of the polynomial plus 1
Bezier Curves in OpenGL (cont.)
Back SMYC Forward
Using an Evaluator
svaexamples/curves/draw.c (Fragment: curve)
 
A Curve Drawing Program
Back SMYC Forward
Adding Points
svaexamples/curves/draw.c (Fragment: onMouseClick)
 
A Curve Drawing Program (cont.)
Back SMYC Forward
Moving Points
svaexamples/curves/draw.c (Fragment: onMouseDrag)
 
A Curve Drawing Program (cont.)
Back SMYC Forward
Drawing the Points and the Curve
svaexamples/curves/draw.c (Fragment: onDisplay)
 
There's Always More to Learn
Back -