Class NURBSCVCurve

3DS Max Plug-In SDK

Class NURBSCVCurve

See Also: Class NURBSCurve, Class NURBSControlVertex.

class NURBSCVCurve : public NURBSCurve

Description:

This class is available in release 2.0 and later only.

This class defines a NURBS CV Curve. CV Curves have control vertices. The position of the control vertices (CVs) controls the shape of the curve. Unlike spline vertices, CVs don’t necessarily lie on the curve they define. The CVs define a control lattice which surrounds the NURBS curve.

All methods of this class are implemented by the system.

Data Members:

protected:

NURBSControlVertex *mpCVs;

Array of control vertices.

double *mpKnots;

Array of knots.

BOOL mClosed;

TRUE if the curve is closed; otherwise FALSE.

int mOrder;

The order of the curve.

int mNumKnots;

The number of knots.

int mNumCVs;

The number of control verticies.

NURBSAutoParam mAutoParam;

This data member is available in release 3.0 and later only.

Controls automatic reparameterization. See List of NURBSAutoParam Types.

Friend Classes:

friend class NURBSSet;

Methods:

public:

Prototype:

NURBSCVCurve();

Remarks:

Constructor. The data members are initialized as follows:

 mType = kNCVCurve;

 mClosed = FALSE;

 mpCVs = NULL;

 mpKnots = NULL;

Prototype:

virtual ~NURBSCVCurve();

Remarks:

Destructor. If the knots and CV arrays are allocated they are freed and any caches are cleared.

Prototype:

void Close();

Remarks:

Closes the curve.

Prototype:

void SetOrder(int order);

Remarks:

Sets the order of the curve. This is one more than the degree of polynomial of any segment of the curve. All curves have a degree. The degree of a curve is the highest exponent in the equation used to represent it. A linear equation is degree 1, a quadratic equation degree 2. NURBS curves typically are represented by cubic equations and have a degree of 3.

Parameters:

int order

Specifies the order of the curve.

Prototype:

int GetOrder();

Remarks:

Returns the order of the curve.

Prototype:

void SetNumKnots(int num);

Remarks:

Sets the number of knots in the curve. Note that the previous knot data is NOT maintained

Because they are generated mathematically, NURBS curves have a parameter space in addition to the 3D geometric space in which they are displayed. Specifically, an array of values called knots specifies the extent of influence of each control vertex (CV) on the curve or surface.

Parameters:

int num

Specifies the number of knots for the curve.

Prototype:

int GetNumKnots();

Remarks:

Returns the number of knots in the curve.

Prototype:

void SetNumCVs(int num);

Remarks:

Set the number of control vertices in the curve. Note that the previous control vertex data is NOT maintained.

Parameters:

int num

Specifies the number of control vertices.

Prototype:

void GetNumCVs(int& num);

Remarks:

Retrieves the number of control vertices.

Parameters:

int& num

The number is stored here.

Prototype:

int GetNumCVs();

Remarks:

Returns the number of control vertices.

Prototype:

double GetKnot(int index);

Remarks:

Returns the knot value whose index is passed.

Parameters:

int index

Specifies which knot value to return.

Prototype:

void SetKnot(int index, double value);

Remarks:

Sets the specified knot to the specified value.

Parameters:

int index

The 0 based index of the knot to set.

double value

Specifies the value to set.

Prototype:

NURBSControlVertex *GetCV(int index);

Remarks:

Returns a pointer to the specified control vertex of the curve.

Parameters:

int index

The 0 based index of the control vertex to return.

Prototype:

void SetCV(int index, NURBSControlVertex &cv);

Remarks:

Sets the specified control vertex to the CV passed.

Parameters:

int index

The 0 based index of the control vertex to set.

NURBSControlVertex &cv

The CV to set.

Prototype:

void SetTransformMatrix(TimeValue t, SetXFormPacket& xPack);

Remarks:

Sets the transformation matrix for the NURBSCVCurve. This controls the relative position of the item within a NURBSSet.

Parameters:

TimeValue t

The time at which to set the matrix.

SetXFormPacket& xPack

An instance of the XFormPacket class that describes the properties of the transformation. See Class SetXFormPacket.

Prototype:

Matrix3 GetTransformMatrix(TimeValue t);

Remarks:

Returns the transformation matrix of the NURBSCVCurve at the specified time.

Parameters:

TimeValue t

The time at which to retrieve the matrix.

Prototype:

NURBSAutoParam AutoParam();

Remarks:

This method is available in release 3.0 and later only.

Returns the current settings for automatic reparameterization. See List of NURBSAutoParam Types.

Prototype:

void AutoParam(TimeValue t, NURBSAutoParam param);

Remarks:

This method is available in release 3.0 and later only.

Sets the automatic reparameterization settings at the specified time.

Parameters:

TimeValue t

The time to set them.

NURBSAutoParam param

The settings to establish. See List of NURBSAutoParam Types.

Prototype:

void Reparameterize(TimeValue t, NURBSParamaterization param);

Remarks:

This method is available in release 3.0 and later only.

This method reparameterizes this CV sub-object. This can be used to provide a better relation between control point locations and the shape of the sub-object.

Parameters:

TimeValue t

The time to reparameterize.

NURBSParamaterization param

The type of reparameterizing to perform. See List of NURBSParamaterization Types.

Prototype:

void EndsOverlap(BOOL& overlap);

Remarks:

This method determines if the ends of the curve overlap even though the curve may not be closed (that is, the tangents match at the ends).

Parameters:

BOOL& overlap

The result is returned here: TRUE if the ends overlap; otherwise FALSE.

Prototype:

void Refine(TimeValue t, double u);

Remarks:

By specifying a parameter point on the curve, this method adds a new control vertex to the curve. It moves all the other CVs but maintains the shape of the curve. Note that this causes the loss of any animation on the curve.

Parameters:

TimeValue t

The time at which to refine the curve. If the curve is animated the u parameter below is time dependent.

double u

Specifies the distance along the curve to add the CV. See the base class method GetParameterRange() for the valid range of values for this parameter.

Prototype:

void Insert(TimeValue t, double u);

Remarks:

This method is available in release 2.5 and later only.

This method places a new CV along the current CV hull at the specified parameter point. This method leaves all the other CVs in place and changes the shape of the curve. This method preserves animation.

Parameters:

TimeValue t

The time at which to refine the curve. If the curve is animated the u parameter below is time dependent.

double u

Specifies the distance along the curve to add the CV. See the base class method GetParameterRange() for the valid range of values for this parameter.

Operators:

Prototype:

NURBSCVCurve & operator=(const NURBSCVCurve& curve);

Remarks:

Assignment operator.

Parameters:

const NURBSCVCurve& curve

The NURBSCVCurve to assign.