BezierPatch Class Reference

A bezier surface with arbitrary dimensions. More...

#include <labelingmath.h>

List of all members.

Public Member Functions

 BezierPatch (bool useDisplayList=true)
 Default constructor.
 ~BezierPatch ()
 Default destructor. Frees all allocated resources.
void setCtrlPoints (tgt::vec3 *ctrlPoints, int degreeS, int degreeT)
 Sets the patch's control points.
int getDegreeS ()
 Returns the patch's horizontal dimension (see constructor).
int getDegreeT ()
 Returns the patch's vertical dimension (see constructor).
tgt::vec3getCtrlPoints (int &degreeS, int &degreeT)
 Returns a pointer to the control point array and writes the patch's dimensions to ref parameters degreeS and degreeT.
tgt::vec3 getPoint (float s, float t)
 Returns the surface point at parameters s and t.
tgt::vec3 getTangentS (float s, float t)
 Returns the tangent in s-direction at the surface point at parameters s and t.
tgt::vec3 getTangentT (float s, float t)
 Returns the tangent in t-direction at the surface point at parameters s and t.
tgt::vec3 getNormal (float s, float t)
 Returns the normal at the surface point at parameters s and t.
void render (int s_steps=10, int t_steps=10, bool genTexCoords=false, GLuint texUnit=0)
 Renders the whole patch (parameter range [0:1]^2) as a quad strip and optionally generates texture coordinates for an arbitrary texture unit.

Detailed Description

A bezier surface with arbitrary dimensions.

The patch is determined by an array of control points with dimensions (degreeS+1)x(degreeT+1). The surface point at parameters s=t=0 is the lower left control point, the surface point at parameters s=t=1 is the upper right control point.

Definition at line 311 of file labelingmath.h.


Member Function Documentation

vec3 * getCtrlPoints ( int &  degreeS,
int &  degreeT 
)

Returns a pointer to the control point array and writes the patch's dimensions to ref parameters degreeS and degreeT.

Definition at line 395 of file labelingmath.cpp.

vec3 getNormal ( float  s,
float  t 
)

Returns the normal at the surface point at parameters s and t.

Definition at line 434 of file labelingmath.cpp.

vec3 getTangentS ( float  s,
float  t 
)

Returns the tangent in s-direction at the surface point at parameters s and t.

Definition at line 412 of file labelingmath.cpp.

vec3 getTangentT ( float  s,
float  t 
)

Returns the tangent in t-direction at the surface point at parameters s and t.

Definition at line 423 of file labelingmath.cpp.

void render ( int  s_steps = 10,
int  t_steps = 10,
bool  genTexCoords = false,
GLuint  texUnit = 0 
)

Renders the whole patch (parameter range [0:1]^2) as a quad strip and optionally generates texture coordinates for an arbitrary texture unit.

Internally a display list is used to speed up rendering.

Parameters:
s_steps number of samplings in s-direction (horizontal)
t_steps number of samplings in t-direction (vertical)
genTextureCoords determines if texture coordinates are generated
texUnit texture unit the texture coordinates are generated for

Definition at line 442 of file labelingmath.cpp.

void setCtrlPoints ( tgt::vec3 ctrlPoints,
int  degreeS,
int  degreeT 
)

Sets the patch's control points.

Parameters:
ctrlPoints control point array, ordered row-wise, beginning at the bottom row
degreeS patch's degree in "horizontal" direction: length of a row of the control point array = degreeS+1
degreeT patch's degree in "vertical" direction: length of a column of the control point array = degreeT+1

Definition at line 383 of file labelingmath.cpp.