pfCurve3d(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfCurve3d(3pf)NAME
pfGetCurve3dClassType, pfGetCurve3dBeginT, pfGetCurve3dEndT,
pfCurve3dSetClosed, pfGetCurve3dClosed, pfCurve3dClosedTol,
pfGetCurve3dClosedTol, pfCurve3dEvalPt, pfCurve3dEvalTan,
pfCurve3dEvalNorm - Abstract base class for all continuous 3D parametric
curves.
FUNCTION SPECIFICATION
#include <Performer/pf.h>
pfType * pfGetCurve3dClassType(void);
pfReal pfGetCurve3dBeginT(pfCurve3d *curve);
pfReal pfGetCurve3dEndT(pfCurve3d *curve);
void pfCurve3dSetClosed(pfCurve3d *curve, int loopVal);
int pfGetCurve3dClosed(pfCurve3d *curve);
void pfCurve3dClosedTol(pfCurve3d *curve, pfReal tol);
pfReal pfGetCurve3dClosedTol(pfCurve3d *curve);
void pfCurve3dEvalPt(pfCurve3d *curve, pfReal t, pfVec3 &pt);
void pfCurve3dEvalTan(pfCurve3d *curve, pfReal t, pfVec3 &pt);
void pfCurve3dEvalNorm(pfCurve3d *curve, pfReal t, pfVec3 &pt);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfCurve3d is derived from the parent class
pfRep, so each of these member functions of class pfRep are also directly
usable with objects of class pfCurve3d. Casting an object of class
pfCurve3d to an object of class pfRep is taken care of automatically.
This is also true for casts to objects of ancestor classes of class
pfRep.
void pfRepOrigin(pfRep *rep, const pfVec3 origin);
void pfRepOrient(pfRep *rep, const pfMatrix mat);
void pfGetRepOrigin(pfRep *rep, pfVec3* origin);
void pfGetRepOrient(pfRep *rep, pfMatrix *mat);
Since the class pfRep is itself derived from the parent class pfGeode,
objects of class pfCurve3d can also be used with these functions designed
for objects of class pfGeode.
int pfAddGSet(pfGeode* geode, pfGeoSet* gset);
int pfRemoveGSet(pfGeode* geode, pfGeoSet* gset);
Page 1
pfCurve3d(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfCurve3d(3pf)
int pfInsertGSet(pfGeode* geode, int index, pfGeoSet* gset);
int pfReplaceGSet(pfGeode* geode, pfGeoSet* old, pfGeoSet* new);
pfGeoSet * pfGetGSet(const pfGeode* geode, int index);
int pfGetNumGSets(const pfGeode* geode);
Since the class pfGeode is itself derived from the parent class pfNode,
objects of class pfCurve3d can also be used with these functions designed
for objects of class pfNode.
pfGroup * pfGetParent(const pfNode *node, int i);
int pfGetNumParents(const pfNode *node);
void pfNodeBSphere(pfNode *node, pfSphere *bsph, int mode);
int pfGetNodeBSphere(pfNode *node, pfSphere *bsph);
pfNode* pfClone(pfNode *node, int mode);
pfNode* pfBufferClone(pfNode *node, int mode, pfBuffer *buf);
int pfFlatten(pfNode *node, int mode);
int pfNodeName(pfNode *node, const char *name);
const char * pfGetNodeName(const pfNode *node);
pfNode* pfFindNode(pfNode *node, const char *pathName,
pfType *type);
pfNode* pfLookupNode(const char *name, pfType* type);
int pfNodeIsectSegs(pfNode *node, pfSegSet *segSet,
pfHit **hits[]);
void pfNodeTravMask(pfNode *node, int which, uint mask,
int setMode, int bitOp);
uint pfGetNodeTravMask(const pfNode *node, int which);
void pfNodeTravFuncs(pfNode* node, int which,
pfNodeTravFuncType pre, pfNodeTravFuncType post);
void pfGetNodeTravFuncs(const pfNode* node, int which,
pfNodeTravFuncType *pre, pfNodeTravFuncType *post);
void pfNodeTravData(pfNode *node, int which, void *data);
void * pfGetNodeTravData(const pfNode *node, int which);
void pfNodeTravMode(pfNode* node, int which, int mode,
int val);
int pfGetNodeTravMode(const pfNode* node, int which,
int mode);
Since the class pfNode is itself derived from the parent class pfObject,
objects of class pfCurve3d can also be used with these functions designed
for objects of class pfObject.
void pfUserDataSlot(pfObject *obj, int slot, void *data);
void pfUserData(pfObject *obj, void *data);
void* pfGetUserDataSlot(pfObject *obj, int slot);
void* pfGetUserData(pfObject *obj);
int pfGetNumUserData(pfObject *obj);
int pfGetNamedUserDataSlot(const char *name);
const char* pfGetUserDataSlotName(int slot);
Page 2
pfCurve3d(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfCurve3d(3pf)
int pfGetNumNamedUserDataSlots(void);
int pfDeleteGLHandle(pfObject *obj);
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfCurve3d can also be used with these
functions designed for objects of class pfMemory.
pfType * pfGetType(const void *ptr);
int pfIsOfType(const void *ptr, pfType *type);
int pfIsExactType(const void *ptr, pfType *type);
const char * pfGetTypeName(const void *ptr);
int pfRef(void *ptr);
int pfUnref(void *ptr);
int pfUnrefDelete(void *ptr);
int pfUnrefGetRef(void *ptr);
int pfGetRef(const void *ptr);
int pfCopy(void *dst, void *src);
int pfDelete(void *ptr);
int pfIsFluxed(void *ptr);
int pfCompare(const void *ptr1, const void *ptr2);
void pfPrint(const void *ptr, uint which, uint verbose,
FILE *file);
void * pfGetArena(void *ptr);
DESCRIPTION
An pfCurve3d abstracts a general two dimensional parametric curve,
parameterized by t, where t has a domain of [endT..beginT]. Each curve
contains a parametric range and a pure virtual function, evalPt, to
evaluate the curve. The pfCurve3d class also contains virtual functions
for evaluating the tangent, curvature, and normal as a function of t. If
a derived class does not provide any one of these higher-order
evaluators, the pfCurve3d classes will approximate these values using
central differences. The central difference is taken about a small delta
in u, given by (endT - beginT) * pfRep::functionTol (see pfRep).
Curves can be open, closed or periodic. In an open curve, the end point
3-D values are not coincident. In a closed curve, the end points are
coincident in position. In a periodic curve, the endpoints are coincident
in position and in tangent, and the parameter t is assumed to wrap
toroidially. Coincidence is defined as the absolute value of the
difference of the two values, such that this quantity is less than that
of getClosedTol. The curve's end point disposition may be overriden via
the method-ref setClosed member function.
pfGetCurve3dClassType returns the pfType* for the class pfCurve3d. The
pfType* returned by pfGetCurve3dClassType is the same as the pfType*
returned by invoking pfGetType on any instance of class pfCurve3d.
Because OpenGL Performer allows subclassing of built-in types, when
decisions are made based on the type of an object, it is usually better
to use pfIsOfType to test if an object is of a type derived from a
Performer type rather than to test for strict equality of the pfType*'s.
Page 3
pfCurve3d(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfCurve3d(3pf)
pfNewCurve3d creates an instance of an pfCurve3d. By default the
parametric domain is defined as [0..1].
pfCurve3dBeginT Sets the beginning parametric t value. This function has
the side effect of evaluating the curve at this value and caching the
result in the class's state.
pfCurve3dEndT Sets the ending parametric t value. This function has the
side effect of evaluating the curve at this value and caching the result
in the class's state.
pfGetCurve3dBeginT Returns the beginning value of the parametric domain.
pfGetCurve3dEndT Returns the ending value of the parametric domain.
pfCurve3dSetClosed Overrides the default value of the curve's end point
disposition as described in the CLASS DESCRIPTION. Once, overriden the
curve's end point disposition is not automatically determined.
pfGetCurve3dClosed Returns the current value of the curve's end point
disposition.
pfCurve3dClosedTol Sets the tolerance used to determine when a curve is
closed. By default, this value is set by pfRep::subtractiveTol.
pfGetCurve3dClosedTol Returns the tolerance used to determine when a
curve is closed. By default this value is set pfRep::subtractiveTol.
pfCurve3dEvalPt Evaluates the curve at parametric value t, placing the
returned value in pnt. Note that this function is a pure virtual
function and must be defined by at least one derived class.
pfCurve3dEvalTan Evaluates the curve's tangent at parametric value t,
placing the returned value in tan. If a derived class does not define a
tangent function, the one in this class is invoked. It will compute the
tangent using central differences (or the analytic tangent of a quadratic
fit) and is given by the equation:
tan = (f(t + dt) - f(t - dt)) / (2.0 * dt)
where f is the point-valued curve function.
pfCurve3dEvalNorm Evaluates the curve's principal normal at parametric
value t, placing the returned value in tan. If a derived class does not
define a normal function, the one in this class is invoked. It computes
the tangent using central differences (or the analytic normal of a
quadratic fit of the tangents) and is given by the equation:
Page 4
pfCurve3d(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfCurve3d(3pf)
tan = (f'(t + dt) - f'(t - dt)) / (2.0 * dt)
where f' is the vector valued tangent function.
pfCurve3dEvalCurv Evaluates the curve's curvature at parametric value t,
placing the returned value in curv. If a derived class does not define a
curvature function, the one in this class is invoked. It computes the
curvature by crossing the curves tangent and principal normal to produce
the binormal. The curvature is given by:
curv = || binormal || / (||tan|| * ||tan|| * ||tan||)
A convenience function that evaluates the position, tangent, curvature
and normal at the parameter t. These values are computed in the manner
described in the individual evaluation routines: pfCurve3dEvalPt,
pfCurve3dEvalTan, pfCurve3dEvalNorm, pfCurve3dEvalCurv.
SEE ALSO
pfRep, pfGeode
Page 5