class MFnNurbsCurve

Jump to documentation

: public MFnDagNode NURBS curve function set. (OpenMaya) (OpenMaya.py)

Inheritance:

MFnNurbsCurve < MFnDagNode < MFnDependencyNode < MFnBase

public members:

MFnNurbsCurve ( const MObject & object, MStatus * ReturnStatus = NULL )
enum Form
kInvalid
kOpen
kClosed
kPeriodic
kLast
MObject create ( const MPointArray &controlVertices, const MDoubleArray &knotSequences, unsigned int degree , Form agForm, bool create2D, bool createRational, MObject & parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject createWithEditPoints ( const MPointArray &editPoints, unsigned int degree , Form agForm, bool create2D, bool createRational, bool uniformParam, MObject & parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MObjectArray & sources, MObject & parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject copy (const MObject &source, MObject &parentOrOwner = MObject::kNullObj , MStatus * ReturnStatus = NULL)
MStatus reverse (bool constructionHistory = false)
MStatus makeMultipleEndKnots ()
MObject cv ( unsigned int index, MStatus * ReturnStatus = NULL ) const
MStatus getCV ( unsigned int index, MPoint &pt, MSpace::Space space = MSpace::kObject ) const
MStatus setCV ( unsigned int index, const MPoint &pt, MSpace::Space space = MSpace::kObject )
Form form ( MStatus * ReturnStatus = NULL ) const
int degree ( MStatus * ReturnStatus = NULL ) const
int numCVs ( MStatus * ReturnStatus = NULL ) const
int numSpans ( MStatus * ReturnStatus = NULL ) const
int numKnots ( MStatus * ReturnStatus = NULL ) const
MStatus getKnotDomain ( double &start, double &end ) const
MStatus getKnots ( MDoubleArray &array ) const
MStatus setKnots ( const MDoubleArray &array, unsigned int startIndex, unsigned int endIndex )
MStatus setKnot ( unsigned int index, double param )
MObject cvs ( unsigned int startIndex, unsigned int endIndex, MStatus * ReturnStatus = NULL ) const
MStatus getCVs ( MPointArray &array, MSpace::Space space = MSpace::kObject ) const
MStatus setCVs ( const MPointArray &array, MSpace::Space space = MSpace::kObject )
double knot ( unsigned int index, MStatus * ReturnStatus = NULL ) const
MStatus removeKnot ( double atThisParam, bool removeAll = false )
bool isPointOnCurve ( const MPoint &point, double tolerance = kMFnNurbsEpsilon, MSpace::Space space = MSpace::kObject , MStatus * ReturnStatus = NULL ) const
MStatus getPointAtParam ( double param, MPoint &point, MSpace::Space space = MSpace::kObject ) const
MStatus getParamAtPoint ( const MPoint & atThisPoint, double &param, MSpace::Space space = MSpace::kObject ) const
MStatus getParamAtPoint ( const MPoint & atThisPoint, double &param, double tolerance, MSpace::Space space = MSpace::kObject ) const
bool isParamOnCurve ( double param, MStatus * ReturnStatus = NULL ) const
MVector normal ( double param, MSpace::Space space = MSpace::kObject , MStatus * ReturnStatus = NULL ) const
MVector tangent ( double param, MSpace::Space space = MSpace::kObject , MStatus * ReturnStatus = NULL ) const
MStatus getDerivativesAtParm ( double param, MPoint &pos, MVector &dU, MSpace::Space space, MVector * dUU = NULL) const
bool isPlanar ( MVector * planeNormal = NULL, MStatus * ReturnStatus = NULL ) const
MPoint closestPoint ( const MPoint &toThisPoint, double * param = NULL, double tolerance = kMFnNurbsEpsilon, MSpace::Space space = MSpace::kObject , MStatus * ReturnStatus = NULL ) const
MPoint closestPoint ( const MPoint &toThisPoint, bool paramAsStart, double * param = NULL, double tolerance = kMFnNurbsEpsilon, MSpace::Space space = MSpace::kObject , MStatus * ReturnStatus = NULL ) const
double distanceToPoint ( const MPoint &pt, MSpace::Space space = MSpace::kObject , MStatus * ReturnStatus = NULL ) const
double area ( double tolerance = kMFnNurbsEpsilon, MStatus * ReturnStatus = NULL ) const
double length ( double tolerance = kMFnNurbsEpsilon, MStatus * ReturnStatus = NULL ) const
double findParamFromLength ( double partLength, MStatus * ReturnStatus = NULL ) const
bool hasHistoryOnCreate ( MStatus * ReturnStatus = NULL )
MStatus updateCurve ()

Inherited from MFnDagNode:

public members:

kNextPos
MObject create ( const MTypeId &typeId, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MTypeId &typeId, const MString &name, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MString &type, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
MObject create ( const MString &type, const MString &name, MObject & parent = MObject::kNullObj , MStatus * ReturnStatus = NULL )
unsigned int parentCount ( MStatus * ReturnStatus = NULL ) const
MObject parent ( unsigned int i, MStatus * ReturnStatus = NULL ) const
MStatus addChild ( MObject & child , unsigned int index = kNextPos , bool keepExistingParents = false )
MStatus removeChild ( MObject & child )
MStatus removeChildAt ( unsigned int index )
unsigned int childCount ( MStatus * ReturnStatus = NULL ) const
MObject child ( unsigned int i, MStatus * ReturnStatus = NULL ) const
MObject dagRoot ( MStatus * ReturnStatus = NULL )
bool hasParent ( const MObject & node, MStatus * ReturnStatus = NULL ) const
bool hasChild (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool isChildOf (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool isParentOf (const MObject & node, MStatus * ReturnStatus = NULL ) const
bool inUnderWorld ( MStatus * ReturnStatus = NULL ) const
bool inModel ( MStatus * ReturnStatus = NULL ) const
bool isInstanceable ( MStatus * ReturnStatus=NULL ) const
MStatus setInstanceable ( const bool how )
bool isInstanced ( bool indirect = true, MStatus * ReturnStatus = NULL ) const
bool isInstancedAttribute ( const MObject & attr, MStatus * ReturnStatus = NULL ) const
unsigned int instanceCount ( bool total, MStatus * ReturnStatus = NULL ) const
MObject duplicate ( bool instance = false, bool instanceLeaf = false, MStatus * ReturnStatus = NULL ) const
MStatus getPath ( MDagPath & path )
MStatus getAllPaths ( MDagPathArray & paths )
MString fullPathName ( MStatus *ReturnStatus = NULL)
MString partialPathName ( MStatus *ReturnStatus = NULL)
MMatrix transformationMatrix ( MStatus * ReturnStatus = NULL ) const
bool isIntermediateObject ( MStatus * ReturnStatus = NULL ) const
MStatus setIntermediateObject ( bool isIntermediate )
int objectColor ( MStatus * ReturnStatus = NULL ) const
MStatus setObjectColor ( int color )
bool usingObjectColor ( MStatus * ReturnStatus = NULL ) const
MStatus setUseObjectColor ( bool useObjectColor )
MBoundingBox boundingBox ( MStatus * ReturnStatus = NULL ) const
MDagPath dagPath ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( const MDagPath & path )
virtual MStatus setObject ( MObject & object )
MObject model ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( const MObject & object )

Inherited from MFnDependencyNode:

public members:

virtual MFn::Type type () const
enum MAttrClass
kGlobalDynamicAttr
kLocalDynamicAttr
MObject create ( const MTypeId & typeId , MStatus * ReturnStatus = NULL )
MObject create ( const MTypeId & typeId , const MString & name , MStatus * ReturnStatus = NULL )
MObject create ( const MString & type , MStatus * ReturnStatus = NULL )
MObject create ( const MString & type , const MString & name , MStatus * ReturnStatus = NULL )
MTypeId typeId ( MStatus * ReturnStatus = NULL ) const
MString typeName ( MStatus * ReturnStatus = NULL ) const
MString name ( MStatus * ReturnStatus = NULL ) const
MString setName ( const MString & name , MStatus * ReturnStatus = NULL )
MStatus getConnections ( MPlugArray & array ) const
unsigned int attributeCount ( MStatus * ReturnStatus=NULL) const
MObject attribute ( unsigned int index, MStatus * ReturnStatus=NULL) const
MObject reorderedAttribute ( unsigned int index, MStatus * ReturnStatus=NULL) const
MObject attribute ( const MString & attrName, MStatus * ReturnStatus=NULL) const
MAttrClass attributeClass ( const MObject & attr, MStatus * ReturnStatus=NULL) const
MStatus getAffectedAttributes ( const MObject & attr, MObjectArray & affectedAttributes ) const
MStatus getAffectedByAttributes ( const MObject & attr, MObjectArray & affectedByAttributes ) const
MPlug findPlug ( const MObject & attr, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MString & attrName, bool wantNetworkedPlug, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MObject & attr, MStatus * ReturnStatus=NULL) const
MPlug findPlug ( const MString & attrName, MStatus * ReturnStatus=NULL) const
MStatus addAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr )
MStatus removeAttribute ( const MObject & attr, MAttrClass type = kLocalDynamicAttr )
MPxNode * userNode ( MStatus * ReturnStatus=NULL ) const
bool isFromReferencedFile ( MStatus * ReturnStatus=NULL) const
bool isShared ( MStatus * ReturnStatus=NULL) const
bool hasUniqueName ( MStatus * ReturnStatus=NULL) const
MString parentNamespace ( MStatus * ReturnStatus=NULL) const
bool isLocked ( MStatus * ReturnStatus=NULL) const
MStatus setLocked ( bool locked )
static MString classification ( const MString & nodeTypeName )
bool isNewAttribute ( const MObject & attr, MStatus * ReturnStatus=NULL) const
static unsigned int allocateFlag ( const MString pluginName, MStatus * ReturnStatus=NULL )
static MStatus deallocateFlag (const MString pluginName, unsigned int flag)
static MStatus deallocateAllFlags (const MString pluginName)
MStatus setFlag (unsigned int flag, bool state)
bool isFlagSet (unsigned int flag, MStatus * ReturnStatus=NULL) const
bool isDefaultNode ( MStatus * ReturnStatus=NULL) const
MStatus setDoNotWrite ( bool flag )
bool canBeWritten ( MStatus * ReturnStatus=NULL) const
bool hasAttribute (const MString & name , MStatus * ReturnStatus=NULL) const
MObject getAliasAttr (bool force, MStatus * ReturnStatus=NULL)
bool setAlias (const MString & alias,const MString & name , const MPlug & plug, bool add=true, MStatus * ReturnStatus=NULL)
bool findAlias (const MString & alias, MObject & attrObj, MStatus * ReturnStatus=NULL) const
bool getAliasList ( MStringArray & strArray, MStatus * ReturnStatus=NULL)
MString plugsAlias (const MPlug & plug, MStatus * ReturnStatus=NULL)
public
bool getPlugsAlias (const MPlug & plug, MString & aliasName, MStatus * ReturnStatus=NULL)

Inherited from MFnBase:

public members:

virtual MFn::Type type () const
bool hasObj ( MFn::Type ) const
bool hasObj ( const MObject & ) const
MObject object ( MStatus * ReturnStatus = NULL ) const
virtual MStatus setObject ( MObject & object )
virtual MStatus setObject ( const MObject & object )

Documentation

Manipulate NURBS curve objects
Description

This is the function set for NURBS (Non-Uniform Rational B-Spline) curves.

The shape of a NURBS curve is defined by an array of CVs (control vertices), an array of knot values, a degree, and a form. There are 3 possible "forms" for the curve: open, closed and periodic.

The open and closed forms are quite similar, and in fact a closed curve will become an open curve if either the first or last CV is moved so that they are no longer coincident. To create an open or closed curve of degree N with M spans, you must provide M+N CVs. This implies that for a degree N curve, you must specify at least N+1 CVs to get a curve with a single span.

The number of knots required for a curve is M + 2N - 1. If you want the curve to start exactly at the first CV and end exactly at the last CV, then the knot vector must be structured to have degree N "multiplicity" at the beginning and end. This means that the first N knots must be identical, and the last N knots must be identical.

A periodic curve is a special case of a closed curve. Instead of having just the first and last CVs coincident, the last N CVs in the curve must overlap the first N CVs. This results in a curve with no tangent break at the seam where the ends meet. The last N CVs in a periodic curve are permanently bound to the first N CVs, and Maya will not allow those last N CVs to be repositioned. If one or more of the first N CVs of the curve are repositioned, the overlapping CV's will remain bound, and will also be moved.

In order to create a periodic curve, you must specify at least 2N+1 CVs, so that that last N can overlap the first N and you still have 1 non-overlapping CV left. The number of CVs required to create a periodic curve is still N+M (with a lower limit of 2N+1), but you must ensure that the positions of the last N CVs are identical to the positions of the first N.

You still need M + 2N - 1 knots for a periodic curve, but the knot values required are more restrictive than for open or closed curves because of the overlap at the ends, The difference between the first N pairs of knots values should be equal to the difference between the last N pairs. Additionally there can be no knot multiplicity at the ends of the curve, because that would compromise the tangent continuity property. So an example knot sequence could begin with knots at { -(N-2), -(N-1), ... , 0}.

Functions

MFnNurbsCurve:: MFnNurbsCurve ()

Description

Default class constructor. The function set is not attached to an MObject.

MFnNurbsCurve:: MFnNurbsCurve ( MObject & object, MStatus * ReturnStatus )

Description

Class constructor that initializes the function set to the given MObject.

Arguments

  • object the MObject to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnNurbsCurve:: MFnNurbsCurve ( const MObject & object, MStatus * ReturnStatus )

Description

Class constructor that initializes the function set to the given constant MObject.

Arguments

  • object the const MObject to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFnNurbsCurve:: MFnNurbsCurve ( const MDagPath & object, MStatus * ReturnStatus )

Description

Class constructor that initializes the function set to the given constant MDagPath object.

Arguments

  • object the const MDagPath to attach the function set to
  • ReturnStatus the return status
    • MS::kSuccess if the function set is successfully attached
    • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

MFn::Type MFnNurbsCurve:: type () const

Description

Return the type of this function set.

Return Value

  • the constant MFn::kNurbsCurve

MFnNurbsCurve:: ~MFnNurbsCurve ()

Description

Class desctructor.

MObject MFnNurbsCurve:: create ( const MPointArray &controlVertices, const MDoubleArray &knots, unsigned int degree , MFnNurbsCurve::Form form , bool create2D, bool createRational, MObject & parentOrOwner, MStatus * ReturnStatus )

Description

This method creates a nurbs curve from the given control vertices and knot vector and sets this function set to operate on the new curve.

The parentOrOwner argument is used to specify the owner of the new curve.

If the parentOrOwner is kNurbsCurveData then the created curve will be of type kNurbsCurveGeom and will be returned. The parentOrOwner will become the owner of the new curve.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the curve. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new curve will be returned and the parentOrOwner will become its parent.

The knot vector is valid if it is non-decreasing and of length spans + 2 * degree - 1. The cvs are assumed to be in rational form (as opposed to homogeneous)

If the form specified is kClosed and the endpoints are not close then a new span will be created inorder to close the curve.

Arguments

  • controlVertices an array of control vertices
  • knots an array of knots
  • degree the degree to create the curve with
  • form either kOpen, kClosed, kPeriodic
  • create2D indictates whether to create 2D or 3D curve
  • createRational true means curve being created will be rational
  • parentOrOwner the DAG parent or kNurbsCurveData the new curve will belong to
  • ReturnStatus Status code

Return Value

  • If parentOrOwner is NULL then the transform for this curve is returned
  • If parentOrOwner is a DAG object then the curve shape is returned
  • The curve geometry is returned if parentOrOwner is of type kNurbsCurveData

Status Codes

  • MS::kSuccess Curve was successfully created
  • MS::kInvalidParameter Invalid parameter specified
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Error creating curve

MObject MFnNurbsCurve:: createWithEditPoints ( const MPointArray &editPoints, unsigned int degree , MFnNurbsCurve::Form form , bool create2D, bool createRational, bool uniformParam, MObject & parentOrOwner, MStatus * ReturnStatus )

Description

This method creates a nurbs curve from the given edit points and sets this function set to operate on the new curve.

The parentOrOwner argument is used to specify the owner of the new curve.

If the parentOrOwner is kNurbsCurveData then the created curve will be of type kNurbsCurveGeom and will be returned. The parentOrOwner will become the owner of the new curve.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the curve. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new curve will be returned and the parentOrOwner will become its parent.

If the form specified is kClosed and the endpoints are not close then a new span will be created inorder to close the curve.

Arguments

  • editPoints an array of edit points
  • degree the degree to create the curve with
  • form either kOpen, kClosed, kPeriodic
  • create2D indictates whether to create 2D or 3D curve
  • createRational true means curve being created will be rational
  • uniformParam true means curve being created will have uniform parameterization, false means chord length
  • parentOrOwner the DAG parent or kNurbsCurveData the new curve will belong to
  • ReturnStatus Status code

Return Value

  • If parentOrOwner is NULL then the transform for this curve is returned
  • If parentOrOwner is a DAG object then the curve shape is returned
  • The curve geometry is returned if parentOrOwner is of type kNurbsCurveData

Status Codes

  • MS::kSuccess Curve was successfully created
  • MS::kInvalidParameter Invalid parameter specified
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Error creating curve

MObject MFnNurbsCurve:: create ( const MObjectArray & sources, MObject & parentOrOwner, MStatus * ReturnStatus)

Description

This method creates a single curve that represents all the curves in the MObjectArray. The method assumes the curves in the sources are good for building a single curve: . they are in the same direction, . they are not intersective to themselvies or eath other, . there are no gaps between the points at the ends. . the order of the curves in the array are followed, i.e. the result curve starts from sources[0].

It is good enough to be C0 continouns (tangent breaks are okay).

Arguments

  • ReturnStatus Status code

Return Value

  • If parentOrOwner is NULL then the transform for this curve is returned
  • If parentOrOwner is a DAG object then the curve shape is returned
  • The curve geometry is returned if parentOrOwner is of type kNurbsCurveData

Status Codes

  • MS::kSuccess Curve was successfully created
  • MS::kInvalidParameter Invalid parameter specified
  • MS::kFailure Error creating curve

MObject MFnNurbsCurve:: copy (const MObject &source, MObject & parentOrOwner, MStatus * ReturnStatus )

Description

This method creates a copy of a nurbs curve.

The parentOrOwner argument is used to specify the owner of the new curve.

If the parentOrOwner is kNurbsCurveData then the created curve will be of type kNurbsCurveGeom and will be returned. The parentOrOwner will become the owner of the new curve.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the curve. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new curve will be returned and the parentOrOwner will become its parent.

Arguments

  • source the curve to be copied
  • parentOrOwner the DAG parent or kNurbsCurveData the new curve will belong to
  • ReturnStatus Status code

Return Value

  • If parentOrOwner is NULL then the transform for this curve is returned
  • If parentOrOwner is a DAG object then the curve shape is returned
  • The curve geometry is returned if parentOrOwner is of type kNurbsCurveData

Status Codes

  • MS::kSuccess Curve was successfully created
  • MS::kInvalidParameter Invalid parameter specified
  • MS::kLicenseFailure Application not licensed for attempted operation
  • MS::kFailure Error creating curve

MObject MFnNurbsCurve:: cv ( unsigned int index, MStatus * ReturnStatus ) const

Description

Get a direct access handle to the CV at the specified index.
The CV iterator class MItCurveCV must be used to access the returned CV.

Arguments

  • ReturnStatus Status code

Return Value

  • A handle to the CVs requested

Status Codes

  • MS::kSuccess The method was successful
  • MS::kInvalidParameter CV index out of range
  • MS::kFailure An object error has occurred

MStatus MFnNurbsCurve:: getCV ( unsigned int index, MPoint &pt, MSpace::Space space ) const

Description

Get the CV at the given index.

Arguments

  • index The index of the CV that will be retrieved
  • pt Storage for the CV
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The CV was successfully set
  • MS::kInvalidParameter CV index out of range
  • MS::kFailure Object error

MStatus MFnNurbsCurve:: setCV ( unsigned int index, const MPoint &pt, MSpace::Space space )

Description

Set the CV at the given index to the given point.
The method updateCurve should be called to trigger changes in the curve.

Arguments

  • index The index of the CV that will be changed
  • pt The new value that the CV will take
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The CV was successfully set
  • MS::kInvalidParameter CV index out of range
  • MS::kFailure Object error

MFnNurbsCurve::Form MFnNurbsCurve:: form ( MStatus * ReturnStatus ) const

Description

This method returns the form of the curve. The curve can be open, closed, or periodic.

Arguments

  • ReturnStatus Status code

Return Value

  • MFnNurbsCurve::kOpen
  • MFnNurbsCurve::kClosed
  • MFnNurbsCurve::kPeriodic

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

int MFnNurbsCurve:: degree ( MStatus * ReturnStatus ) const

Description

Return the degree of this curve. If the degree cannot be determined then 0 is returned.

Arguments

  • ReturnStatus Status code

Return Value

  • The degree of this curve.

Status Codes

  • MS::kSuccess The degree was successfully returned.
  • MS::kFailure An object error has occurred.

int MFnNurbsCurve:: numCVs ( MStatus * ReturnStatus ) const

Description

Return the number of CVs for this curve. If the number of CVs cannot be determined then 0 is returned.

Arguments

  • ReturnStatus Status code

Return Value

  • The number of CVs for this curve.

Status Codes

  • MS::kSuccess The number of CVs was successfully returned.
  • MS::kFailure An object error has occurred.

int MFnNurbsCurve:: numSpans ( MStatus * ReturnStatus ) const

Description

Return the number of spans for this curve. If the number of spans cannot be determined then 0 is returned.

Arguments

  • ReturnStatus Status code

Return Value

  • The number of spans for this curve.

Status Codes

  • MS::kSuccess The number of spans was successfully returned.
  • MS::kFailure An object error has occurred.

int MFnNurbsCurve:: numKnots ( MStatus * ReturnStatus ) const

Description

Return the number of knots for this curve. If the number of knots cannot be determined then 0 is returned.

Arguments

  • ReturnStatus Status code

Return Value

  • The number of knots for this curve.

Status Codes

  • MS::kSuccess The number of knots was successfully returned.
  • MS::kFailure An object error has occurred.

MStatus MFnNurbsCurve:: getKnotDomain ( double &start, double &end ) const

Description

Return the range corresponding to the maximum and minimum parameter values for this curve.

Arguments

  • start storage for the max parameter value
  • end storage for the min parameter value

Return Value

  • Status code

Status Codes

  • MS::kSuccess The range was successfully returned
  • MS::kFailure Object error

MStatus MFnNurbsCurve:: getKnots ( MDoubleArray &array ) const

Description

This method retrieves a copy of the knot array for this curve.

Arguments

  • array storage where the parameter values of the knots for this curve will be copied

Return Value

  • Status code

Status Codes

  • MS::kSuccess The knots were successfully copied
  • MS::kFailure Object error

MStatus MFnNurbsCurve:: setKnots ( const MDoubleArray &array, unsigned int startIndex, unsigned int endIndex )

Description

This method is used to set the values of a contiguous group of knots of the curve. The range of knots to set is specified using the start and end index. The knots of index startIndex to endIndex inclusive will be set using the value in the double array.

Knot indices range from 0 to numKnots() - 1

Arguments

  • array a double array of knot points
  • startIndex the starting index of the knots to be altered.
  • endIndex the ending index of the knots to be altered.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Invalid start or end indices, or the length of the array is not sufficient to fill the range given, or the knots are in decreasing order.
  • MS::kFailure An object error has occurred

MObject MFnNurbsCurve:: cvs ( unsigned int startIndex, unsigned int endIndex, MStatus * ReturnStatus ) const

Description

This method is used to directly access a contiguous group of CVs.
The returned group can be accessed via the MItCurveCV class. Any modifications to these CVs will affect this curve. updateCurve should be called to cause the curve to redraw itself.

Arguments

  • startIndex the start index for the CVs to return
  • endIndex the end index for the CVs to return
  • ReturnStatus Status code

Return Value

  • An MObject providing direct-access to the specified CVs

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter CV index out of range
  • MS::kFailure An object error has occurred.

MStatus MFnNurbsCurve:: getCVs ( MPointArray &array, MSpace::Space space ) const

Description

Get the positions of the CVs of this curve. The returned group can be accessed via the MPointArray class. Any modifications to these CVs will not affect this curve. setCVs should be called to modify the original curve. updateCurve should be called to cause the curve to redraw itself.

Arguments

  • array The array of point values for the CVs
  • space Specifies the coordinate system for this operation

Return Value

  • ReturnStatus Status code

Status Codes

  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Cannot do world space transform
  • MS::kFailure An object error has occurred

MStatus MFnNurbsCurve:: setCVs ( const MPointArray &array, MSpace::Space space )

Description

Set the CVs for this curve to the given points.

Arguments

  • array The array of point values for the CVs
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Cannot do world space transform.
  • MS::kFailure An object error has occurred.

double MFnNurbsCurve:: knot ( unsigned int index, MStatus * ReturnStatus ) const

Description

Get the parameter value of the specified knot for this curve.
Knot indices range from 0 to numKnots() - 1

Arguments

  • index The knot index
  • ReturnStatus Status code

Return Value

  • The parameter value for the knot at index.

Status Codes

  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Knot index out of range
  • MS::kFailure An object error has occurred

MStatus MFnNurbsCurve:: setKnot ( unsigned int index, double param )

Description

Set the given knot's parameter value.
Knot indices range from 0 to numKnots() - 1.

If a knot value is set that breaks the non-decreasing requirement for the knot array, the knot value will be changed and a kInvalidParameter error will be returned.

Arguments

  • index Index of the knot to be set
  • param The parameter value that the knot will take

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Knot index out of range or new knot value breaks the non-decreasing requirement for the knot array.
  • MS::kFailure An object error has occurred

MStatus MFnNurbsCurve:: removeKnot ( double atThisParam, bool removeAll )

Description

Remove knot(s) from this curve.
If removeAll is true then all of the knots except for the knot at the given parameter value will be removed.
If removeAll is false then only the knot at the given parameter value will be removed.

Arguments

  • atThisParam Status code
  • removeAll Determines whether we remove all knots, or all but one

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Parameter value is out of range
  • MS::kFailure An object error has occurred

bool MFnNurbsCurve:: isPointOnCurve ( const MPoint &point, double tolerance, MSpace::Space space, MStatus * ReturnStatus ) const

Description

Determines whether the given point is on this curve.

Arguments

  • point The point to test
  • tolerance The amount of error (epsilon value) in the calculation
  • space Specifies the coordinate system for this operation
  • ReturnStatus Status code

Return Value

  • true The given point is on the curve.
  • false The given point is NOT on the curve.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnNurbsCurve:: getPointAtParam ( double param, MPoint &point, MSpace::Space space ) const

Description

Returns the point in space that is at the given parameter value of the curve. If the parameter value does not give a valid point on the curve, then MS::kInvalidParameter is returned.

Arguments

  • param The parameter value that we are examining
  • point Storage for the point being returned
  • space Specifies the coordinate system for this operation

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Invalid parameter specified.
  • MS::kFailure An object error has occurred.

MStatus MFnNurbsCurve:: getParamAtPoint ( const MPoint & atThisPoint, double& param, MSpace::Space space ) const

Description

This method retrieves the parameter value corresponding to the given point on the curve.

Arguments

  • asThisPoint Point to check
  • param storage for the parameter value
  • space Specifies the coordinate system for this operation

Return Value

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnNurbsCurve:: getParamAtPoint ( const MPoint & atThisPoint, double& param, double tolerance, MSpace::Space space ) const

Description

This method retrieves the parameter value corresponding to the given point on the curve.

Arguments

  • asThisPoint Point to check
  • param storage for the parameter value
  • tolerance tolerance used for operation
  • space Specifies the coordinate system for this operation

Return Value

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

bool MFnNurbsCurve:: isParamOnCurve ( double param, MStatus * ReturnStatus ) const

Description

Determines whether the specified parameter value is within the bounds of the knot vector of this curve

Arguments

  • param The parameter value to check
  • ReturnStatus Status code

Return Value

  • true The parameter is on this curve.
  • false Parameter is NOT on this curve.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MVector MFnNurbsCurve:: normal ( double param, MSpace::Space space, MStatus * ReturnStatus ) const

Description

This method returns the normal at the given parameter value on the curve. For degree 1 curves the normal is the vector at right angles to the curve that lies in the average plane of the curve. For higher degrees the normal is defined by the local curvature at param.

Arguments

  • param The parameter of the point on the curve from which to get the normal
  • ReturnStatus Status code

Return Value

  • The normal vector for the given parameter

Status Codes

  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Normal cannot be found for the given parameter value
  • MS::kFailure An object error has occurred

MVector MFnNurbsCurve:: tangent ( double param, MSpace::Space space, MStatus * ReturnStatus ) const

Description

This method returns the tangent at the given parameter value on the curve. The resulting tangent vector is normalized.

Arguments

  • param The parameter of the point on the curve from which to get the tangent
  • ReturnStatus Status code

Return Value

  • The tangent vector for the given parameter

Status Codes

  • MS::kSuccess The method was successful
  • MS::kInvalidParameter Tangent cannot be found for the given parameter value
  • MS::kFailure An object error has occurred

MStatus MFnNurbsCurve:: getDerivativesAtParm ( double param, MPoint &pos, MVector &dU, MSpace::Space space, MVector * dUU ) const

Description

Evaluate the surface at the given parameter returning the position, first derivative and optionally the seecond derivative. Derivatives are not normalized.

Arguments

  • param U parameter value to evaluate
  • pos Storage for the XYZ position of the curve
  • du Storage for the first order partial derivative with respect to u
  • duu Pointer to storage for the second order partial derivative with respect to u
  • space Coordinate space for the returned vectors

Return Value

  • Status Code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Parameter does not define a point on the curve
  • MS::kFailure An object error has occurred.

bool MFnNurbsCurve:: isPlanar ( MVector * planeNormal, MStatus * ReturnStatus ) const

Description

This method determines if this curve is a planar curve. If planeNormal is non-NULL then the normal to the plane containing this curve is returned in this location.

Arguments

  • planeNormal Storage for the normal to the plane containing this curve
  • ReturnStatus Status code

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MPoint MFnNurbsCurve:: closestPoint ( const MPoint &toThisPoint, double* param, double tolerance, MSpace::Space space, MStatus * ReturnStatus ) const

Description

This method determines the closest point on the curve to the given point.

Arguments

  • point The point to test
  • param pointer to a double. If non-null, on successful returns this will contain the parameter value of the returned point.
  • tolerance The amount of error (epsilon value) in the calculation
  • space Specifies the coordinate system for this operation

  • ReturnStatus Status code

Return Value

  • The point on the curve closest to the given point.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MPoint MFnNurbsCurve:: closestPoint ( const MPoint &toThisPoint, bool paramAsStart, double* param, double tolerance, MSpace::Space space, MStatus * ReturnStatus ) const

Description

This method determines the closest point on the curve to the given point. Performance can be greatly increased by supplying a starting parameter value that is reasonably close to the final point.

Arguments

  • point The point to test
  • paramAsStart If true use the value pointed to by param as a starting point for the search.
  • param pointer to a double. If non-null, on successful returns this will contain the parameter value of the returned point.
  • tolerance The amount of error (epsilon value) in the calculation
  • space Specifies the coordinate system for this operation
  • ReturnStatus Status code

Return Value

  • The point on the curve closest to the given point.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

double MFnNurbsCurve:: distanceToPoint ( const MPoint &pt, MSpace::Space space, MStatus * ReturnStatus ) const

Description

This method determines the distance from the given point to closest point on the curve.

Arguments

  • pt The point to calculate the distance to
  • space Specifies the coordinate system for this operation
  • ReturnStatus Status code

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

double MFnNurbsCurve:: area ( double tolerance, MStatus * ReturnStatus ) const

Description

This method returns the area bounded by this curve. The curve must be closed and planar.

A value of 0.0 will be returned if area cannot be determined.

Arguments

  • tolerance The amount of error (epsilon value) in the calculation
  • ReturnStatus Status code

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

double MFnNurbsCurve:: length ( double tolerance, MStatus * ReturnStatus ) const

Description

Return the arc length of this curve or 0.0 if it cannot be computed.

Arguments

  • tolerance The amount of error (epsilon value) in the calculation
  • ReturnStatus Status code

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

double MFnNurbsCurve:: findParamFromLength ( double partLength, MStatus * ReturnStatus ) const

Description

Given the length along the curve, find the parameter value that corresponds to it. If the parameter value cannot be found for the given length then ReturnStatus is set to kInvalidParameter and the parameter for the end point of the curve is returned.

Arguments

  • partLength Length along the curve to find parameter value at
  • ReturnStatus Status code

Return Value

  • The parameter value corrisponding to the given length. If a parameter cannot be found for the given length then the parameter for the end point of the curve is returned.

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kInvalidParameter Parameter value cannot be found
  • MS::kFailure An object error has occurred.

bool MFnNurbsCurve:: hasHistoryOnCreate ( MStatus * ReturnStatus )

Description

This method determines if the shape was created with history.

If the object that this function set is attached to is not a shape then this method will fail.

Arguments

  • ReturnStatus

Return Value

  • true shape has history
  • false shape does not have history

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnNurbsCurve:: updateCurve ()

Description

This method signals that this curve has changed and needs to be recalculated.

This method is useful when a large number of CVs for the curve are being modified. Instead of updating the curve every time a CV is changed it is more efficient to call this method once after updating all of the CVs.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnNurbsCurve:: reverse (bool constructionHistory )

Description

This method reverse the curve direction.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

MStatus MFnNurbsCurve:: makeMultipleEndKnots ()

Description

This method gives end knots full multiplicity. This ensures the end points of the curve interpolate the first and last CVs. It can also be used to convert a periodic curve to a closed curve.

Return Value

  • Status code

Status Codes

  • MS::kSuccess The method was successful.
  • MS::kFailure An object error has occurred.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright