AlCurve

Interface to Alias NURBS curves geometry.

Synopsis

#include <AlCurve.h>
class AlCurve : public AlObject
AlCurve();
virtual ~AlCurve();
virtual statusCode deleteObject();
virtual AlObject* copyWrapper() const;
statusCode create( int, curveFormType, int, const double[], int, const double[][4], const int[]);
statusCode create( int, curveFormType, const double[], int, const double[][4]);
statusCode createLine( const double[3], const double[3] );
statusCode createArc( const double[3], const double[3], const double[3], boolean );
statusCode createConic( double, double, double, double, double, double, const double[3], const double[3] );
statusCode createParabola( const double[3], const double[3], const double[3], const double[3] );
statusCode createEllipse( const double[3], const double[3], const double[3], const double[3], const double[3] );
statusCode createHyperbola( const double[3], const double[3], const double[3], const double[3], const double[3] );
virtual AlObjectType type() const;
virtual AlCurve* asCurvePtr();
AlCurveNode* curveNode() const;
curveFormType form() const;
int degree() const;
int numberOfSpans() const;
int numberOfCVs() const;
AlCurveCV* firstCV() const;
AlAttributes* firstAttribute() const;
statusCode CVsWorldPosition( double[][4], int[] ) const;
statusCode CVsAffectedPosition( const AlTM&, double[][4], int[] ) const;
statusCode CVsUnaffectedPosition( double[][4], int[] ) const;
virtual statusCode setCVsUnaffectedPosition( const double[][4] );
statusCode length( double& len, boolean worldCoords = TRUE, double tolerance=0.001 );
statusCode eval(double, boolean, double P[3] = NULL, double dP[3] = NULL ) const;
statusCode eval( double dist, double P[3], boolean worldCoordinates = TRUE, double tolerance = 0.001) const;
int numberOfKnots() const;
statusCode knotVector( double[] ) const;
statusCode setKnotVector( const double[] );
int numberOfCVsInclMultiples() const;
statusCode CVsWorldPositionInclMultiples( double[][4] )const;
statusCode CVsAffectedPositionInclMultiples( const AlTM&, double[][4] ) const;
statusCode CVsUnaffectedPositionInclMultiples( double[][4] ) const;
virtual statusCode setCVsUnaffectedPositionInclMultiples( const double[][4] );
int realNumberOfKnots() const;
statusCode realKnotVector( double[] ) const;
statusCode setRealKnotVector( const double[] );
boolean isDisplayModeSet( AlDisplayModeType ) const;
statusCode setDisplayMode( AlDisplayModeType, boolean );
statusCode applyIteratorToCVs( AlIterator*, int& );
statusCode doUpdates( boolean newState = TRUE );
statusCode periodicSplineToOpen() const;
statusCode periodicToNonPeriodic() const;
virtual statusCode normal(double [3]) const;
statusCode insert( double param );
statusCode append( double pos[4], AlPointType type );

Description

AlCurve is the interface to the geometric data of Alias' NURBS curve objects. To create a curve, first instantiate and create an AlCurve and then instantiate and create an AlCurveNode.

For more information on how to create the curve geometry, see the description for the create() method.

A curve form can be one of three types: periodic, closed or open. If a curve is "kPeriodic", it is tangent continuous at all points on the curve and its endpoints are coincident. If a curve is "kClosed", it is not periodic but its endpoints are coincident. If the curve is neither closed nor periodic, it is considered to be "kOpen".

There are two ways to delete an AlCurve. If the AlCurve destructor is called, the attached AlCurveNode is deleted. If the AlCurveNode destructor is called, the attached AlCurve is deleted.

You should always create a curve node for a curve. If you create a curve with no curve node, the curve is not added to the universe. If you should lose the pointer to the curve, it will become lost memory.

There is one limitation to this class: you cannot add or remove individual curve control points (except by changing multiplicity).

Curves are made of curve control points (or CVs) which you can traverse as a list by using AlCurve::firstCV() plus the AlCurveCV methods. You can also pack the curve information into an array using methods in this class.

What is multiplicity?

An AlCurveCV object can actually represent multiple CVs, depending on the AlCurveCVs multiplicity and periodicity. Notice that in this class there are two sets of methods - some "InclMultiples" and some not (namely "numberOfCVs", "CVsWorldPosition", "CVsUnaffectedPosition", etc). The set of methods without multiplicity lets you get all curve CV's where a curve CV can have multiplicity of 1, 2 or 3. The set of methods "InclMultiples" lets you get ALL curve CVs including multiples due to a multiplicity > 1 and due to periodicity.

Example 1:

If you create a curve in the interactive Alias package with 4 CVs and change the multiplicity of the second CV to 2 (using the "multiplicity" menu item in the Curve Tools menu), then:

  1. numberOfCVs() will return 4.

  2. CVsWorldPosition must be passed a 4x4 CVs matrix, and a multiplicity vector of length 4.

  3. CVsUnaffectedPosition() must be passed the same as item 2.

  4. setCVsUnaffectedPosition() must be passed the same as item 2.

  5. numberOfCVsInclMultiples() will return 5.

  6. CVsWorldPositionInclMultiples() must be passed a 5x4 CVs matrix. You will notice that the 2nd and 3rd points in this matrix are the same.

  7. CVsUnaffectedPositionInclMultiples() must be passed the same as item 6. You will notice that the 2nd and 3rd points in this matrix are the same.

  8. setCVsUnaffectedPositionInclMultiples() must be passed the same as item 6. The matrix you pass in should have the 2nd and 3rd points the same. What really happens in this method is that the 3rd point is given the same value as the 2nd point. (What you give as the 3rd point is ignored).

Example 2:

If you create a curve in the interactive Alias package with 4 CVs and "close" the curve (using the "close" menu item in the Object Tools menu), you create a periodic curve. Then:

  1. numberOfCVs() will return 4.

  2. CVsWorldPosition must be passed a 4x4 CVs matrix, and a multiplicity vector of length 4.

  3. CVsUnaffectedPosition() must be passed the same as item 2.

  4. setCVsUnaffectedPosition() must be passed the same as item 2.

  5. numberOfCVsInclMultiples() will return 7.

  6. CVsWorldPositionInclMultiples() must be passed a 7x4 CVs matrix. You will notice that in this matrix the 5th, 6th and 7th points are the same as the 1st, 2nd and 3rd points respectively.

  7. CVsUnaffectedPositionInclMultiples() must be passed the same as item 6. You will notice that in this matrix the 5th, 6th and 7th points are the same as the 1st, 2nd and 3rd points respectively.

  8. setCVsUnaffectedPositionInclMultiples() must be passed the same as item 6. The matrix you pass in should have the 5th, 6th and 7th points the same as the 1st, 2nd and 3rd points respectively. What really happens in this method is that the 5th, 6th and 7th points are assigned the same values as the 1st, 2nd and 3rd points respectively. (What you give for the 5th, 6th and 7th points are ignored).

Summary

AlCurve::AlCurve()

Description

Constructs an AlCurve wrapper object.

AlCurve::~AlCurve()

Description

Deletes an AlCurve wrapper object.

AlObject *AlCurve::copyWrapper() const

Description

Returns an exact copy of the AlCurve wrapper.

statusCode AlCurve::deleteObject()

Description

This method deletes the AlCurve.

Return codes

sSuccess - the curve was deleted

sInvalidObject - the curve was invalid.

AlObjectType AlCurve::type() const

Description

Returns the class identifier kCurveType.

AlCurve* AlCurve::asCurvePtr()

Description

This virtual function returns a non-null pointer to itself, indicating that it is safe to cast to an object of this class.

AlCurveNode* AlCurve::curveNode() const

Description

Returns the curve node associated with this curve. Returns NULL if there is no attached curve node.

curveFormType AlCurve::form() const

Description

When a curve is periodic it means that its endpoints are coincident and that the curve is tangent continuous at the point where its endpoints touch. "kPeriodic" is returned in this case. "kClosed" is returned if the curve is not periodic, but if its endpoints are coincident. If a curve is neither "kPeriodic" nor "kClosed" then "kOpen" is returned. (Note: If you use the "close" menu item in the interactive Alias package, you actually make a curve periodic.)

int AlCurve::degree() const

Description

Returns the degree of the curve. -1 is returned if the curve is not valid.

int AlCurve::numberOfSpans() const

Description

Returns the number of spans in the curve. -1 is returned if the curve is not valid.

int AlCurve::numberOfCVs() const

Description

Returns the number of CVs. -1 is returned if the curve is not valid.

AlCurveCV* AlCurve::firstCV() const

Description

Returns a pointer to the first CV in the curve.

AlAttributes* AlCurve::firstAttribute() const

Description

Returns the first attribute on this curve if any, otherwise NULL is returned. Note that if CV positions are modified through any of the AlCurve, AlCurveCV, AlCluster, AlSet, etc. then the attributes are removed from the curve.

statusCode AlCurve::CVsWorldPosition( double CVList[][4], int multiplicity[] ) const

Description

Returns the CVs in the given CV array and the multiplicity of each CV in the multiplicity vector. The first dimension of the CV array must be numberOfCVs(). The length of the multiplicity vector must also be numberOfCVs(). The multiplicity vector returned by this function is the same as the one returned by CVsUnaffectedPosition().

Arguments

> CVList - returned CV positions

> multiplicity - the multiplicity of each CV

Return codes

sSuccess - the curve CVs positions were returned

sInvalidObject - the curve was not valid

sFailure - an error occurred

sInvalidArgument - a NULL argument was supplied

statusCode AlCurve::CVsAffectedPosition( const AlTM& tm, double CVList[][4], int multiplicity[] ) const

Description

Returns the CVs in the given CV array and the multiplicity of each CV in the multiplicity vector. The first dimension of the CV array must be numberOfCVs(). The length of the multiplicity vector must also be numberOfCVs(). The multiplicity vector returned by this function is the same as the one returned by CVsUnaffectedPosition().

Arguments

< tm - the transformation matrix built by tranversing the dag.

> CVList - returned CV positions

> multiplicity - the multiplicity of each CV

Return codes

sSuccess - the curve CVs positions were returned

sInvalidObject - the curve was not valid

sFailure - an error occurred

sInvalidArgument - a NULL argument was supplied

statusCode AlCurve::CVsUnaffectedPosition( double CVList[][4],int multiplicity[] ) const

Description

Returns the CVs in the given CV array and the multiplicity of each CV in the multiplicity vector. The first dimension of the CV array must be numberOfCVs(). The length of the multiplicity vector must also be numberOfCVs(). The multiplicity vector returned by this function is the same as the one returned by CVsWorldPosition().

Arguments

> CVList - returned CV positions

> multiplicity - the multiplicity of each CV

Return codes

sSuccess - the curve CVs positions were returned

sInvalidObject - the curve was not valid

sInvalidArgument - a NULL argument was supplied

sFailure - an error occurred

statusCode AlCurve::doUpdates( boolean newState )

Description

See AlDagNode for information.

statusCode AlCurve::setCVsUnaffectedPosition( const double CVList[][4] )

Description

Sets the CVs of this curve to the values in the given CV array. The first dimension of the CV array must be numberOfCVs().

Arguments

< CVList - CV positions

Return codes

sSuccess - the curve CVs positions were set

sInvalidObject - the curve was not valid

sInvalidArgument - a NULL argument was supplied

sFailure - an error occurred

statusCode AlCurve::eval(double t, boolean worldCoordinates, double P[3], double dP[3] ) const

Description

Determines the 3D coordinate and the derivative of the parameter value on the curve.

Arguments

< t - parameter position on the curve

< worldCoordinates - the evaluation is performed in world coordinates

> P - the local postion on the curve (if not NULL)

> dP - the derivative of the curve at t (if not NULL)

Return codes

sSuccess - the coordinate was successfully determined

sFailure - the evaluation failed

sInvalidObject - the curve was invalid

statusCode AlCurve::eval( double dist, double P[3], boolean worldCoordinates, double tolerance ) const

Description

Determines the 3D coordinate of the point at a given distance from start of the curve. Error tolerance must be greater than zero.

Arguments

< dist - arc length position on the curve

> P - position of the point on the curve

< worldCoordinates - the evaluation is performed in world coordinates

< tolerance - the error tolerance

Return codes

sSuccess - the coordinate was successfully determined

sFailure - the evaluation failed

sInvalidObject - the curve was invalid

sInvalidArgument - tolerance was non-positive

int AlCurve::numberOfKnots() const

Description

Returns the number of knots in this curve. For more information as to what this number means, see the description for the create() method. -1 is returned if the curve is not valid.

statusCode AlCurve::knotVector( double knotVector[]) const

Description

Returns the knot vector in the given vector. This vector must be of length numberOfKnots(). For more information as to what these values mean, see the description for the create() method.

Arguments

> knotVector - returned knot vector

Return codes

sSuccess - the knot vector was returned

sInvalidObject - the curve was not valid

sInvalidArgument - a NULL argument was supplied

statusCode AlCurve::setKnotVector( const double knotVector[] )

Description

Sets the knot vector to be the given vector. This vector must be of length numberOfKnots(). For more information as to what these values mean, see the description for the create() method.

Arguments

< knotVector - the knot vector to be the given vector

Return codes

sSuccess - the knot vector was set

sInvalidObject - the curve was not valid

sInvalidArgument - a NULL argument was supplied or the knots were not in increasing order

int AlCurve::numberOfCVsInclMultiples() const

Description

Returns the number of CVs including multiples. For more information as to what this value means, see the AlCurve class documentation. -1 is returned if the curve is not valid.

statusCode AlCurve::CVsWorldPositionInclMultiples( double CVList[][4] ) const

Description

Returns the world positions of all CVs in this curve, including multiples. The first dimension of the given CVList must be of length numberOfCVsInclMultiples().

Note that the positions returned are [ x y z w ] and not [ w*x w*y w*z w ].

Arguments

> CVList - the world positions of all CVs

Return codes

sSuccess - the CVs positions were returned

sInvalidObject - the curve was not valid

sInvalidArgument - a NULL argument was supplied

sFailure - an error occurred

statusCode AlCurve::CVsAffectedPositionInclMultiples( const AlTM& tm, double CVList[][4] ) const

Description

Returns the world positions of all CVs in this curve, including multiples. The first dimension of the given CVList must be of length numberOfCVsInclMultiples().

Note that the positions returned are [ x y z w ] and not [ w*x w*y w*z w ].

Arguments

< tm - the transformation matrix built by traversing the dag

> CVList - returned world positions of all CVs

Return codes

sSuccess - the CVs positions were returned

sInvalidObject - the curve was not valid

sInvalidArgument - a NULL argument was supplied

statusCode AlCurve::CVsUnaffectedPositionInclMultiples( double CVList[][4] ) const

Description

Returns the unaffected positions of all CVs in this curve, including multiples. The first dimension of the given CVList must be of length numberOfCVsInclMultiples().

Arguments

> CVList - returned unaffected positions of all CVs

Return codes

sSuccess - the CVs positions were returned

sInvalidObject - the curve was not valid

sInvalidArgument - a NULL argument was supplied

sFailure - an error occurred

statusCode AlCurve::setCVsUnaffectedPositionInclMultiples( const double CVList[][4] )

Description

Sets the unaffected positions of all CVs in this curve, including multiples. The first dimension of the given CVList must be of length numberOfCVsInclMultiples(). You cannot give multiples different values. For example, if you have an open curve where numOfCVs() is 6 and and numOfCVsInclMultiples() is 7 because the 2nd point has a multiplicity of 2, then the 2nd and 3rd quadruple in your CVList should be the same. What really happens is that the 3rd point is given the same value as the 2nd point. (What you give as the 3rd point is ignored). For more information see the examples in the class description.

Arguments

< CVList - the unaffected positions of all CVs

Return codes

sSuccess - the CVs positions were set

sInvalidObject - the curve was not valid

sInvalidArgument - a NULL argument was supplied

sFailure - an error occurred

boolean AlCurve::isDisplayModeSet( AlDisplayModeType mode ) const

Description

Returns TRUE if the specified display mode is toggled on for the curve. Returns FALSE otherwise.

The only valid AlDisplayModeTypes for an AlCurve are

kDisplayGeomHull

kDisplayGeomEditPoints

kDisplayGeomKeyPoints

kDisplayGeomCVs

Arguments

< mode - display mode of interest.

Return codes

FALSE is returned if the curve is not Valid.

statusCode AlCurve::setDisplayMode( AlDisplayModeType mode, boolean on_or_off)

Description

For the given display mode, if the flag on_or_off is TRUE then the display mode for the surface is set, otherwise it is unset.

The only valid AlDisplayModeTypes for an AlCurve are

kDisplayGeomHull

kDisplayGeomEditPoints

kDisplayGeomKeyPoints

kDisplayGeomCVs

Arguments

< mode - display mode of interest.

< on_or_off - boolean deciding if this surface will have the display mode set

Return values

sSuccess - if this operation was successful.

sInvalidObject - the curve was invalid sInvalidArgument - invalid display type.

statusCode AlCurve::create( int deg, curveFormType form, int numKnots, const double knotVector[], int numControlPts, const double controlPoint[][4], const int multiplicity[])

Description

This method is used to create the geometric data that represents this curve.

Briefly, Alias curves are represented by an array of knots and an array of control points. (For a detailed understanding of nurbs curves see the book "An Introduction to Splines for use in Computer Graphics and Geometric Modeling" by Bartels, Beatty and Barsky. aka The Killer B's.) The number of spans in a curve is determined by the degree of the curve and the number of control points, namely there are 'numControlPts - deg' spans. Knot values are associated with the ends of each span. Therefore, 'numKnots' must be equal to 'number of spans + 1'.

The expert will notice that 'numKnots' = 'number of spans + 1' does not give us enough knots to specify all the basis functions properly. (The correct number of knots required, according to the Killer B's are numSpans + 2*degree + 1). However since Alias piles knots up at the extreme ends of an open nurbs curve (in order to force the curve to touch each end control point) this method does not require that the user specify the redundant knot values. For example, if the knot vector for a three span open curve contained the knot values [0 1 2 3], the real knot vector would be [0 0 0 0 1 2 3 3 3 3]. In the case of a periodic curve the values of the knots can be determined implicitly from the knots values provided and again don't need to be provided explicitly. For example, if the knot vector for a four span periodic curve contained the knot values [-1 1 2 5 10], the real knot vector would be [-10 -9 -6 -1 1 2 5 10 12 13 16].

If this object was previously referencing some other curve, and this call succeeds, this object will reference the new curve.

For more information on multiplicity, see the AlCurve Description.

When you create a curve, you must ensure the following

Arguments

< deg - The degree of the curve.

< form - Open, closed or periodic.

< numKnots - The number of knots in the knotVector.

< knotVector - The sequence of knot values. Must be of length numKnots.

< numControlPts - The number of points in controlPoint.

< controlPoint - The array of control points. Must have size of numControlPts * 4.

< multiplicity - The multiplicity values. Must be of length numControlPts. Assumed to be an array of 1's if NULL.

Return code

sSuccess - All ok.

sInsufficientMemory - Ran out of memory.

sInvalidArgument - a NULL argument was supplied.

sFailure - did not work.

filter out the illegal Face types (virtual functions still can't stop it) .

statusCode AlCurve::create( int deg, curveFormType form, const double knotVector[], int numControlPts, const double controlPoint[][4] )

Description

This method is used to create the geometric data that represents this curve according to the standard Killer B's representation.

Note this method's differences from the other create method. This method assumes that the size of the number of knots passed in the knot vector is always numControlPts + deg + 1 (or numSpans + 2*deg + 1, if you prefer, where numSpans = numControlPts - deg). That is, the redundant end knots must be specified.

This method assumes that if this object was previously referencing some other curve, and this call succeeds, this object will reference the new curve.

For more information on multiplicity, see the AlCurve Description.

When you create a curve, you must ensure the following:

Arguments

< deg - The degree of the curve.

< form - Open, closed or periodic.

< knotVector - The sequence of knot values. Must be of length numControlPts + deg + 1.

< numControlPts - The number of points in controlPoint.

< controlPoint - The array of control points. Must have size of numControlPts * 4.

Return code

sSuccess - All ok.

sInsufficientMemory - Ran out of memory.

sInvalidArgument - a NULL argument was supplied.

sFailure - did not work.

filter out the illegal Face types (virtual funcs still can't stop it)

statusCode AlCurve::createLine( const double start[3], const double end[3] )

Description

This method is used to create straight lines using attributes. This method is simpler than the previous create method, requiring you only to specify the beginning and end of the curve. To modify the curve you should retrieve its attributes with the firstAttribute() method and use the appropriate AlAttribute methods to modify it. Modifying the CVs directly will cause the attributes to be deleted.

Arguments

< start - the coordinates for the start of the curve.

< end - the coordinates for the end of the curve.

Return code

sSuccess - All ok.

sFailure - Failed to create the curve.

sInvalidArgument - start or end was NULL

sInsufficientMemory - Ran out of memory.

filter out the illegal Face types (virtual functions still can't stop it)

statusCode AlCurve::createArc( const double start[3], const double end[3], const double other[3], boolean circle )

Description

This method is used to create a circular arc using attributes. This method is simpler than the previous create method, requiring you only to specify three points on the curve and whether the curve should be closed to form a circle. To modify the curve you should retrieve its attributes with the firstAttribute() method and use the appropriate AlAttribute methods to modify it. Modifying the CVs directly will cause the attributes to be deleted.

Arguments

< start - the coordinates for the start of the curve.

< end - the coordinates for the end of the curve.

< other - an additional point defining the arc.

< circle - if TRUE then a circle will be generated.

Return code

sSuccess - All ok.

sFailure - Failed to create the curve.

sInsufficientMemory - Ran out of memory.

sAlreadyCreated - the AlCurve has already been created

sInvalidArgument - a NULL argument was supplied

filter out the illegal Face types (virtual functions still can't stop it)

statusCode AlCurve::createConic( double c_a, double c_b, double c_c, double c_d, double c_e, double c_f, const double start[3], const double end[3] )

Description

This method is used to create a conic arc using attributes. This method is simpler than the previous create method, requiring users only to specify the coefficients of the conic and the beginning and end of the curve. The start and end points must lie on the conic.

The conic is described by the equation

A * X^2 + B * X * Y + C * Y^2 + D * X + E * Y + F = 0

The conic will be created in the XY plane.

It is not possible to modify a conic curve through its attributes.

Arguments

< c_a through c_f - coefficient of the conic.

< start - the coordinates for the start of the curve.

< end - the coordinates for the end of the curve.

Return codes

sSuccess - All ok.

sFailure - Failed to create the curve.

sInsufficientMemory - Ran out of memory.

sInvalidArgument - a NULL argument was supplied

sAlreadyCreated - the AlCurve has already been created

statusCode AlCurve::createParabola( const double vertex[3], const double focus[3], const double start[3], const double end[3] )

Description

This method is used to create a parabolic arc using attributes. This method is simpler than the previous create method, requiring users only to specify the vertex and focus of the parabola and the beginning and end of the curve. The start and end points must lie on the parabola. The parabola will be created in the XY plane. It is not possible to modify a parabolic curve through its attributes.

Arguments

< vertex - the vertex of the parabola.

< focus - the focus of the parabola.

< start - the coordinates for the start of the curve.

< end - the coordinates for the end of the curve.

Return code

sSuccess - All ok.

sFailure - Failed to create the curve.

sInsufficientMemory - Ran out of memory.

sInvalidArgument - a NULL argument was supplied

sAlreadyCreated - the AlCurve has already been created

filter out the illegal Face types (virtual functions still can't stop it)

statusCode AlCurve::createEllipse( const double center[3], const double major_axis[3], const double minor_axis[3], const double start[3], const double end[3] )

Description

This method is used to create an elliptical arc using attributes. This method is simpler than the previous create method, requiring users only to specify the center, major axis, and minor axis of the ellipse and the beginning and end of the curve. The start and end points must lie on the ellipse and be specified in a counterclockwise order to indicate the arc. The axes must be perpendicular to each other. When creating an elliptical arc, the axes MUST be specified in the XY plane. It is not possible to modify an elliptical curve through its attributes. It is not possible to create a closed curve with this method, hence it will always fail for AlFaces.

Arguments

< center - the center of the ellipse.

< major_axis - the focus of the ellipse.

< minor_axis - the focus of the ellipse.

< start - the coordinates for the start of the curve.

< end - the coordinates for the end of the curve.

Return code

sSuccess - All ok.

sFailure - Failed to create the curve.

sInsufficientMemory - Ran out of memory.

sInvalidArgument - a NULL argument was supplied.

sAlreadyCreated - the AlCurve has already been created

filter out the illegal Face types (virtual functions still can't stop it)

statusCode AlCurve::createHyperbola( const double center[3], const double major_axis[3], const double minor_axis[3], const double start[3], const double end[3] )

Description

This method is used to create a hyperbolic arc using attributes. This method is simpler than the previous create method, requiring users only to specify the center, major axis, and minor axis of the hyperbola and the beginning and end of the curve. The start and end points must lie on the ellipse and be specified in a counterclockwise order to indicate the arc. The axes must be perpendicular to each other. The hyperbola will be created in the XY plane. It is not possible to modify a hyperbolic curve through its attributes.

Arguments

< center - the center of the hyperbola.

< major_axis - the focus of the hyperbola.

< minor_axis - the focus of the hyperbola.

< start - the coordinates for the start of the curve.

< end - the coordinates for the end of the curve.

Return code

sSuccess - All ok.

sFailure - Failed to create the curve.

sInsufficientMemory - Ran out of memory.

sInvalidArgument - a NULL argument was supplied.

sAlreadyCreated - the AlCurve has already been created

filter out the illegal Face types (virtual functions still can't stop it)

int AlCurve::realNumberOfKnots() const

Description

Returns the actual number of knots on the curve. That is uNumberOfSpans() + 2*degree() - 1. (Note that two additional knots are required to define a NURBS curve, but they have no effect on the curve so are not included in this count.) This method returns -1 if the curve is not valid.

statusCode AlCurve::realKnotVector( double knotVector[] ) const

Description

Returns realNumberOfKnots() in 'knotVector' for the curve.

Arguments

> knotVector - array to place the knot vector into

Return codes

sSuccess - successfully copied the curve's knot vector into knotVector

sInvalidArgument - knotVector was NULL

sInvalidObject - the curve was invalid

statusCode AlCurve::setRealKnotVector( const double knotVector[] )

Description

Sets the knots for this curve. The parameter 'knotVector' must be of 'realNumberofKnots()'.

Arguments

< knotVector - array of knots

Return codes

sSuccess - the knots were successfully set.

sInvalidArgument - knotVector was NULL

sInvalidObject - the curve is invalid

statusCode AlCurve::length(double& len , boolean worldCoordinates, double tolerance )

Description

Determines the length of the curve in either local coordinates or world space coordinates.

Arguments

> len - the returned length

> worldCoordinates - if the calculation is to be done in world space

> tolerance - the error tolerance

Return codes

sSuccess - the length was successfully determined

sFailure - the evaluation failed

sInvalidObject - the curve was invalid

statusCode AlCurve::periodicSplineToOpen( ) const

Description

If a curve is periodic, convert it to non-periodic curve by making it have multiple end knots. The passed curve is modified (don't modify the original curve!).

Return codes

sSuccess - the curve CVs positions were returned

sInvalidObject - the curve was not valid

sFailure - an error occurred

statusCode AlCurve::periodicToNonPeriodic( ) const

Description:

If a curve is periodic, convert it to non-periodic curve (closed curve) by making it have multiple end knots.

Note:

This method modifies the curve. It will not succeed for an AlCurve that exists in the AlUniverse; that is, it must not have a parent AlCurveNode.

Return codes:

sInvalidObject - the curve was invalid.

sFailure - the method didn't succeed

sSuccess - the curve was converted to non-periodic one.

statusCode AlCurve::normal( double normal[3] ) const

Description

Test if bspline is planar and return normal. Find the first three points that are not co-linear, construct a normal and test if the bspline lies in the plane. If the bspline is planar and closed the normal is returned with a clockwise orientation looking down on the plane, and the normal pointing towards you. If the bspline is a line or all the points are co-linear, a unique normal can not be defined.

Arguments

> normal - returned normal vector to the bspline

Return codes

sSuccess - found normal to curve

sFailure - normal could not be found, either the spline is a point, linear or not planar

statusCode AlCurve::insert( double param )

Description

Insert an edit point into the curve.

Arguments

< param - parametric value of the new edit point on the curve

Return codes

sSuccess - edit point was successfully inserted

sInvalidObject - the given object is not valid

sInvalidArgument - param is out of bounds

sFailure - an error occurred

statusCode AlCurve::append( double pos[4], AlPointType type )

Description

Append a CV or an edit point to the curve.

Arguments

< pos - position in world space of new point

< type - either kCV or kEditPoint

Return codes

sSuccess - new point was successfully appended

sInvalidObject - the given object is not valid

sInvalidArgument - an invalid argument was supplied

sFailure - an error occurred

statusCode AlCurve::applyIteratorToCVs( AlIterator* iter, int &rc )

Description

Apply the given iterator to all the CVs in this class. See the documentation for AlIterator.

Arguments

< iter - the iterator to apply to each CV

> rc - the result of the last application of the iterator

Return codes

sSuccess - the iterator exited normally

sFailure - the iterator exited abnormally

sInvalidArgument - the iterator 'iter' was NULL

sInvalidObject - the curve was not valid





aliasdocs@aw.sgi.com
Copyright © 1996, Alias|Wavefront, a Silicon Graphics Company. All rights reserved.