KFbxNurbsCurve Class Reference

#include <kfbxnurbscurve.h>

Inherits KFbxGeometry.

Inheritance diagram for KFbxNurbsCurve:

Inheritance graph
List of all members.

Detailed Description

A Non-Uniform Rational B-Spline (Nurbs) curve is a type of parametric geometry.

A Nurbs curve is defined by the degree, form, knot vector and control points.

Let M be the degree of the curve. Let N be the number of control points of the curve.

The form of the curve can be open, closed or periodic. A curve with end points that do not meet is defined as an open curve. The number of knots in an open curve is defined as N+(M+1).

A closed curve simply has its last control point equal to its first control point. Note that this does not imply tangent continuity at the end point. The curve may have a kink at this point. In FBX the last control point is not specified by the user in the InitControlPoints() method. For example, if there are to be 10 control points in total, and the curve is to be closed, than only 9 control points need to be passed into the InitControlPoints() method. The last control point is implied to be equal to the first control point. Thus N represents the number of unique CVs.

A periodic curve has its last M control points equal to its first M control points. A periodic curve is tangent continuous at the ends. Similiar to a closed curve, when creating a periodic curve, only the unique control points need to be set. For example a periodic curve of degree 3 with 10 control points requires only 7 CVs to be specified in the InitControlPoints() method. The last 3 CVs, which are the same as the first 3, are not included.

The calculation of the number of knots in closed and periodic curves is more complex. Since we have excluded one CV in N in a closed curve, the number of knots is N+(M+1)+1. Similiarly, we excluded M CVs in periodic curves so the number of knots is N+(M+1)+M.

Note that FBX stores one extra knot at the beginning and and end of the knot vector, compared to some other graphics applications such as Maya. The two knots are not used in calculation, but they are included so that no data is lost when converting from file formats that do store the extra knots.

Definition at line 91 of file kfbxnurbscurve.h.

Public Types

enum  EDimension
 The dimension of the CVs
  • e2D The CVs are two dimensional points
  • e3D The CVs are three dimensional points.
More...
enum  EType
 The form of the curve
  • eOPEN
  • eCLOSED
  • ePERIODIC.
More...

Public Member Functions

virtual KFbxNodeAttribute::EAttributeType GetAttributeType () const
 Return the type of node attribute.
void InitControlPoints (int pCount, EType pVType)
 Allocate memory space for the array of control points as well as the knot vector.
double * GetKnotVector () const
 Get knot vector.
int GetKnotCount () const
 Get the number of elements in the knot vector.
void SetOrder (int pOrder)
int GetOrder () const
 Get nurb curve order.
void SetDimension (EDimension dim)
 Sets the dimension of the CVs For 3D curves: control point = ( x, y, z, w ), where w is the weight For 2D curves: control point = ( x, y, 0, w ), where the z component is unused, and w is the weight.
EDimension GetDimension () const
 Gets the dimension of the control points.
K_DEPRECATED void SetRational (bool pRational)
 Sets if the curve should be rational or not.
bool IsRational ()
 Determines if the curve is rational or not.
int GetSpanCount ()
 Calculates the number of spans in the curve using the following: Where S = Number of spans N = Number of CVs M = Order of the curve.
EType GetType () const
 Get nurb type.
bool IsPolyline () const
 Checks if the curve is a poly line.
bool IsBezier ()
 Bezier curves are a special case of nurbs curve.

Protected Types

enum  EError
 Error identifiers. More...

Protected Member Functions

KFbxNurbsCurveoperator= (KFbxNurbsCurve const &pNurb)
 Assignment operator.

Static Protected Member Functions

static char const * GetNamePrefix ()


Member Enumeration Documentation

enum EDimension

The dimension of the CVs

  • e2D The CVs are two dimensional points
  • e3D The CVs are three dimensional points.

Definition at line 102 of file kfbxnurbscurve.h.

enum EType

The form of the curve

  • eOPEN
  • eCLOSED
  • ePERIODIC.

Definition at line 114 of file kfbxnurbscurve.h.

enum EError [protected]

Error identifiers.

  • eINDEX_OUT_OF_RANGE
  • eNULL_PARAMETER
  • eMATERIAL_NOT_FOUND
  • eMATERIAL_ALREADY_ADDED
  • eTEXTURE_NOT_FOUND
  • eTEXTURE_ALREADY_ADDED
  • eSHAPE_ALREADY_ADDED
  • eSHAPE_INVALID_NAME
  • eSHAPE_NAME_CLASH
  • eSHAPE_NO_CURVE_FOUND
  • eUNKNOWN_ERROR

Reimplemented from KFbxGeometry.

Definition at line 230 of file kfbxnurbscurve.h.


Member Function Documentation

virtual KFbxNodeAttribute::EAttributeType GetAttributeType (  )  const [virtual]

Return the type of node attribute.

This class is pure virtual.

Reimplemented from KFbxGeometry.

void InitControlPoints ( int  pCount,
EType  pVType 
)

Allocate memory space for the array of control points as well as the knot vector.

Parameters:
pUCount Number of control points.
pUType Nurb type in U direction.
Remarks:
This function should always be called after KFbxNurb::SetOrder().

double* GetKnotVector (  )  const [inline]

Get knot vector.

Returns:
Pointer to the array of knots.

Definition at line 133 of file kfbxnurbscurve.h.

int GetKnotCount (  )  const

Get the number of elements in the knot vector.

Returns:
The number of knots. See KFbxNurbsCurve description for more details.

int GetOrder (  )  const [inline]

Get nurb curve order.

Returns:
Order value.

Definition at line 147 of file kfbxnurbscurve.h.

void SetDimension ( EDimension  dim  )  [inline]

Sets the dimension of the CVs For 3D curves: control point = ( x, y, z, w ), where w is the weight For 2D curves: control point = ( x, y, 0, w ), where the z component is unused, and w is the weight.

Parameters:
pDimension - the dimension of the control points. (3d or 2d)

Definition at line 154 of file kfbxnurbscurve.h.

EDimension GetDimension (  )  const [inline]

Gets the dimension of the control points.

Returns:
The dimension of the curve

Definition at line 159 of file kfbxnurbscurve.h.

K_DEPRECATED void SetRational ( bool  pRational  )  [inline]

Sets if the curve should be rational or not.

If the curve is rational then the CVs should be formated as ( x, y, z, w ) else they should be ( x/w, y/w, z/w, 1 ) Curve rationality is computed on the fly in the IsRational class now.

Parameters:
pRational - True if the curve is rational, false otherwise.

Definition at line 166 of file kfbxnurbscurve.h.

bool IsRational (  ) 

Determines if the curve is rational or not.

Returns:
True if the curve is rational, false otherwise

int GetSpanCount (  ) 

Calculates the number of spans in the curve using the following: Where S = Number of spans N = Number of CVs M = Order of the curve.

S = N + M + 1;

In this calculation N includes the duplicate CVs for closed and periodic curves.

Returns:
The number of spans if the curve has been initialized, -1 otherwise.

EType GetType (  )  const [inline]

Get nurb type.

Returns:
Nurb curve type identifier.

Definition at line 190 of file kfbxnurbscurve.h.

bool IsPolyline (  )  const [inline]

Checks if the curve is a poly line.

(A polyline is a linear nurbs curve )

Returns:
true if curve is a poly line, false otherwise.

Definition at line 197 of file kfbxnurbscurve.h.

bool IsBezier (  ) 

Bezier curves are a special case of nurbs curve.

This function determines if this nurbs curve is a Bezier curve.

Returns:
true if curve is a Bezier curve, false otherwise.

KFbxNurbsCurve& operator= ( KFbxNurbsCurve const &  pNurb  )  [protected]

Assignment operator.