It's free to join Gamasutra!|Have a question? Want to know who runs this site? Here you go.|Targeting the game development market with your product or service? Get info on advertising here.||For altering your contact information or changing email subscription preferences.
Registered members can log in here.Back to the home page.

Search articles, jobs, buyers guide, and more.

By Alex Ferrier
Gamasutra
August 27, 1999

Printer Friendly Version

Letters to the Editor:
Write a letter
View all letters


Features

 

Contents

Introduction

Objects and Coordinate Systems

Mathematical Definition of Bezier Curves

A Review of Bezier Surfaces

Introducing Bezier Volumes

The FFD Operation

Bringing all the Theory Together

Mathematical Definition of Bezier Curves

A curve is defined geometrically by its control points. We also need a mathematical formula to represent the shape of the curve, so that it can be reproduced on-screen. This section presents a brief derivation of the Bezier curve, leading to Eq. 4, which presents a single function for evaluating the kind of Bezier curve we will be using.

Higher degrees of equation allow more control points and therefore more complexly defined curves - all at the cost of greater computation time. Although it looks complicated, this representation is for a curve of arbitrary degree. In this article, we are going to deal with cubic curves, that it curves with n = 3. This kind of curve is defined by four control points and is particularly useful for defining FFDs.

A Bezier curve is defined by a parametric equation of the form:

With the degree of curve fixed as 3, Eq. 2 can be expanded to produce four equations for

which are dependent only on the curve parameter u, as you can see in Eq. 3:

These functions are called the Bezier basis functions of degree three. You can use them to expand the sigma notation in Eq. 2. The result is a single function that we can use to evaluate the position on a cubic Bezier curve at any value of the parameter u:

We could draw the resulting curve by calculating the value of the function at a number of intervals and then connecting them with straight lines. Listing 1 shows code to evaluate Q(u) at any point on the curve.

Listing 1

CVector3D CEvaluator::EvalCurve(CURVECTRLPTS P, float u)
{

assert (P != NULL);
assert ((u >= 0.0f) && (u <= 1.0f));
float B[4];
CVector3D Ret(0.0f);
B[0] = (1.0f - u) * (1.0f - u) * (1.0f - u);
B[1] = 3.0f * u * (1 - u) * (1.0f - u);
B[2] = 3.0f * u * u * (1.0f - u);
B[3] = u * u * u;

for (int i = 0; i < 4; i++)

Ret += P[i]*B[i];

return Ret;

}


A Review of Bezier Surfaces


join | contact us | advertise | write | my profile
news | features | companies | jobs | resumes | education | product guide | projects | store



Copyright © 2003 CMP Media LLC

privacy policy
| terms of service