Interface
to Alias blend curves.
Synopsis
#include <AlBlendCurve.h>
class AlBlendCurve : public AlObject
enum AlKnotSpacingType {
kChord,
kUniform
};
AlBlendCurve();
virtual ~AlBlendCurve();
virtual statusCode deleteObject();
virtual AlObject* copyWrapper() const;
statusCode create( int , AlKnotSpacingType , int , const double[][3] );
statusCode create( int , AlKnotSpacingType );
virtual AlObjectType type() const;
int degree();
statusCode setDegree( int );
statusCode knotSpacingType( AlKnotSpacingType& );
statusCode setKnotSpacingType( AlKnotSpacingType );
int numberOfPoints();
statusCode param( int, double& );
AlBlendPoint* getPoint( int );
statusCode points( int, double[] );
statusCode insert( int, double, double, double );
statusCode append( double, double, double );
boolean isPicked();
AlBlendCurve* next();
statusCode nextD( AlBlendCurve * );
AlBlendCurve* prev();
statusCode prevD( AlBlendCurve * );
AlCurveNode* curveNode();
Description
An Alias Blend Curve
is a normal NURBS curve with construction history. This class allows
blend curves to be created and intersected with other curves, curves on
surfaces, blend curves and surfaces. Note that intersection with
clouds is not currently supported. Blend Curves contain Blend Points
so it is necessary to use the AlBlendPoint class to make use of
all of the Blend Curve functionality. To find the curve node which
is the output of the Blend Curve command, use the curveNode() method.
Notes:
1. If a blend curve is
active and the API is used to create another blend curve, the first blend
curve will become inactive.
2. Blend curves can be
made active or inactive by finding the curveNode() method and calling
pick() on unpick() with the AlCurveNode.
AlBlendCurve::AlBlendCurve()
Description
NULL
constructor.
AlBlendCurve::~AlBlendCurve()
Description
NULL
destructor.
statusCode AlBlendCurve::deleteObject()
Description
This
method deletes a blend curve object and any points it has. In addition,
the output AlCurve of the blend curve object is deleted.
Return Codes
sSuccess - the object
was successfully deleted
sFailure - the method
failed
sInvalidObject - the
object was invalid
AlObject *AlBlendCurve::copyWrapper()
const
Description
Returns
an exact copy of the blend curve wrapper. NULL is returned if this
method failed.
statusCode AlBlendCurve::create(
int degree, AlKnotSpacingType ks )
Description
Create
a blend curve based on a specified degree and knot spacing. Points
are added to the blend curve using the insertPoint() or appendPoint()
methods.
Arguments
< degree - one of
1, 2, 3, 5, or 7
< ks - kChord or kUniform
Return Codes
sSuccess - a blend curve
was created
sFailure - blend curve
is currently valid, or other internal error occurred
sInvalidArgument - degree
is not one of 1, 2, 3, 5, 7
statusCode AlBlendCurve::create(
int degree, AlKnotSpacingType ks, int numPoints, const double points[][3])
Description
Create a blend curve
based on a specified degree, knot spacing and points. More points can
be added to the blend curve using the insertPoint() or appendPoint()
methods. Note: a new point is initially not connected to any object,
has a location interpolation direction, and has a parallel direction
type.
Arguments
< degree - one of
1, 2, 3, 5, or 7
< ks - kChord or kUniform
< numPoints - number
of points in the point[] array
< points[] - array
of 3D points
Return Codes
sSuccess - a blend curve
was created
sFailure - blend curve
is currently valid, or other internal error occurred
sInvalidArgument - degree
is not one of 1, 2, 3, 5, 7, or points are too close together (tolerance
= 0.01).
AlObjectType AlBlendCurve::type()
const
Description
Returns
the class identifier kBlendCurveType.
int AlBlendCurve::degree()
Description
Returns
the degree of the blend curve. Note that -1 is returned if the blend
curve is invalid or if an internal error occurs.
statusCode AlBlendCurve::setDegree(
int degree )
Description
Sets
the degree of the blend curve.
Arguments
< degree - one of
1, 2, 3, 5, or 7
Return Codes
sSuccess - the method
succeeded
sFailure - internal failure
sInvalidArgument - degree
was not one of 1, 2, 3, 5 or 7
sInvalidObject - invalid
blend curve
statusCode AlBlendCurve::knotSpacingType( AlKnotSpacingType&
kst )
Description
Returns
the knot spacing setting of the blend curve.
Arguments
> kst - knot spacing
of the curve
Return Codes
sSuccess - the method
succeeded
sFailure - internal failure
sInvalidObject - invalid
blend curve
statusCode AlBlendCurve::setKnotSpacingType( AlKnotSpacingType
kst )
Description
Sets
the knot spacing of the blend curve.
Arguments
< kst - kChord or
kUniform
Return Codes
sSuccess - the method
succeeded
sFailure - internal failure
sInvalidObject - invalid
blend curve
int AlBlendCurve::numberOfPoints()
Description
Returns
the number of points in a blend curve. If this method fails, -1
is returned. This method will fail if the blend curve is invalid.
statusCode AlBlendCurve::param(
int index, double& param )
Description
Returns
the param or ’t’ value of the blend point at the index specified
in the blend curve. The first blend point is at index = 0.
Arguments
index - the index of
the point on the blend curve to return the param for param - the
blend point’s param value
Return Codes
sSuccess - the method
succeeded
sFailure - internal failure,
sInvalidObject - the
blend point is invalid
AlBlendPoint* AlBlendCurve::getPoint(
int index )
Description
Returns
the Nth point of the blend curve. NULL is returned if this method
fails. This method will fail if index is less than 0 or greater
than the number of points in the blend curve. The first blend
curve point is at index = 0.
statusCode AlBlendCurve::points(
int numPoints, double points[] )
Description
Returns
the world position of the points of a blend curve.
Example code:
int num = blendCurve->numberOfPoints(); double *points = (double *) malloc( sizeof(double) * num * 3 ); if ( points == NULL ) return; if ( blendCurve->points( num, points ) != sSuccess ) return; double *pt = points; for ( int i = 0 ; i < num ; i++ ) { pt[0] += x; pt[1] += y; pt[2] += z; pt += 3; }
Note: numPoints can be
less than the actual number of points. The method will place as many
points as possible into the array and then return successfully.
Arguments
< numPoints - size
of the points array, must be a value greater than 0. For every n
points, you need to allocate n * 3 elements
> points - array to
return points in
Return Codes
sSuccess - the method
succeeded
sFailure - internal failure
sInvalidObject - the
blend curve is invalid
sInvalidArgument - numPoints
< 1
statusCode AlBlendCurve::insert(
int index, double x, double y, double z )
Description
Inserts
a new blend point before the blend point at the index specified.
Note: a new point is initially not connected to any object, has
a location interpolation direction, and has a parallel direction
type.
Arguments
< index - position
to insert the point before
< x,y,z - world space
location of the new point
Return Codes
sSuccess - method succeeded
sFailure - internal failure
sInvalidObject - the
blend curve is invalid
sInvalidArgument - index
< 0 or falls after the last point
statusCode AlBlendCurve::append(
double x, double y, double z)
Description
Appends
a new blend point to the end of the blend curve. Note: a new point
is initially not connected to any object, has a location interpolation
direction, and has a parallel direction type.
Arguments
x,y,z - the world space
coordinates of the new blend point
Return Codes
sSuccess - the method
succeeded
sFailure - internal failure
sInvalidObject - the
blend curve is invalid
AlCurveNode* AlBlendCurve::curveNode()
Description
Returns
the construction history curve that is the output of the blend curve.
boolean AlBlendCurve::isPicked()
Description
Returns
TRUE is the blend curve is currently picked. FALSE is returned if
the blend curve is invalid or if an internal error occurs.
lBlendCurve* AlBlendCurve::next()
Description
Returns
the next blend curve in the Universe.
statusCode AlBlendCurve::nextD(
AlBlendCurve *blendCurve )
Description
Destructive
method for returning the next blend curve in the universe. sFailure
is returned if there is no next blend curve in the universe.
Arguments
< blendCurve - the
blend curve to obtain the next blend curve from
Return Codes
sSuccess - the method
worked sFailure - the method failed, could be due to there being no
next blend curve sInvalidObject - this blend curve is invalid
AlBlendCurve* AlBlendCurve::prev()
Description
Returns
the previous blend curve in the Universe.
statusCode AlBlendCurve::prevD(
AlBlendCurve *blendCurve )
Description
Destructive
method for returning the previous blend curve in the universe. sFailure
is returned if there is no previous blend curve in the universe.
Arguments
< blendCurve - the
blend curve to obtain the previous blend curve from
Return Codes
sSuccess - the method
worked sFailure - the method failed, could be due to there being no
previous blend curve sInvalidObject - this blend curve is invalid