MarSTDv2004: CBezier3 Class Reference

MarSTDv2004

CBezier3 Class Reference

Collaboration diagram for CBezier3:

Collaboration graph
[legend]
List of all members.

Detailed Description

The bezier patch class uses a 3rd degree function to calculate a patch using 4x4 control points. The patch will touch the four outer control points. The rest of the control points will affect the shape of the patch.
// Example:

void add_bezier(CBsp& bsp) {

        CBezier3 bezier;
        
        // Set corner control points.
        
        bezier.p[0][0].set(-1.0, -1.0, -1.0);
        bezier.p[3][0].set(+1.0, -1.0, -1.0);
        bezier.p[3][3].set(+1.0, +1.0, -1.0);
        bezier.p[0][3].set(-1.0, +1.0, -1.0);
        
        // Generate 10x10 patch.
        
        bezier.generate(10);
        
        // Export to mesh. Remember that CBsp is derived from CMesh.
        
        bezier.to_mesh(bsp);

}

Definition at line 55 of file CBezier.h.

Public Member Functions

 CBezier3 ()
 ~CBezier3 ()
void generate (int a_resolution=7)
void translate (CVector delta)
void toMesh (CMesh &mesh)

Public Attributes

CVector p [4][4]
 4x4 grid of control points.
CVector ** v
 Output grid points.
int resolution
 Resolution of output grid.

Constructor & Destructor Documentation

CBezier3::CBezier3  ) 
 

Constructor.

CBezier3::~CBezier3  ) 
 

Destructor.


Member Function Documentation

void CBezier3::generate int  a_resolution = 7  ) 
 

Generates the output grid. The grid will be resolution*resolution sized. If resolution <= 0, all memory will be freed instead.

Parameters:
resolution The resolution of the generated patch. The generated patch will have resolution*resolution points.

void CBezier3::translate CVector  delta  ) 
 

Translates all control points by the specified vector. You will need to regenerate to update the output grid.

Parameters:
delta The delta vector will be added to all 4x4 control points.

void CBezier3::toMesh CMesh mesh  ) 
 

Outputs the generated points as triangles.

Parameters:
mesh Target mesh to output triangles.


The documentation for this class was generated from the following file:
Generated on Tue Feb 8 21:59:30 2005 for MarSTDv2004 by  doxygen 1.4.1