pfCurve2d(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfCurve2d(3pf)NAME
pfGetCurve2dClassType, pfCurve2dBeginT, pfCurve2dEndT,
pfGetCurve2dBeginT, pfGetCurve2dEndT, pfCurve2dSetClosed,
pfGetCurve2dClosed, pfCurve2dClosedTol, pfGetCurve2dClosedTol,
pfCurve2dEvalPt, pfCurve2dEvalTan, pfCurve2dEvalNorm, pfCurve2dEvalCurv,
pfCurve2dEvalAll - Abstract base class for all continuous 2D parametric
curves.
FUNCTION SPECIFICATION
#include <Performer/pf.h>
pfType * pfGetCurve2dClassType(void);
void pfCurve2dBeginT(pfCurve2d *curve, pfReal t);
void pfCurve2dEndT(pfCurve2d *curve, pfReal t);
pfReal pfGetCurve2dBeginT(pfCurve2d *curve);
pfReal pfGetCurve2dEndT(pfCurve2d *curve);
void pfCurve2dSetClosed(pfCurve2d *curve, pfLoop loopVal);
pfLoop pfGetCurve2dClosed(pfCurve2d *curve);
void pfCurve2dClosedTol(pfCurve2d *curve, pfReal tol);
pfReal pfGetCurve2dClosedTol(pfCurve2d *curve);
void pfCurve2dEvalPt(pfCurve2d *curve, pfReal t, pfVec2 &pt);
void pfCurve2dEvalTan(pfCurve2d *curve, pfReal t, pfVec2 &pt);
void pfCurve2dEvalNorm(pfCurve2d *curve, pfReal t, pfVec2 &pt);
void pfCurve2dEvalCurv(pfCurve2d *curve, pfReal *curv);
void pfCurve2dEvalAll(pfCurve2d *curve, pfReal t, pfVec2 &pt,
pfVec2 &tan, pfReal *curv, pfVec2 norm);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfCurve2d is derived from the parent class
pfRep, so each of these member functions of class pfRep are also directly
usable with objects of class pfCurve2d. Casting an object of class
pfCurve2d 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);
Page 1
pfCurve2d(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfCurve2d(3pf)
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 pfCurve2d 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);
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 pfCurve2d 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 pfCurve2d can also be used with these functions designed
for objects of class pfObject.
Page 2
pfCurve2d(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfCurve2d(3pf)
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);
int pfGetNumNamedUserDataSlots(void);
int pfDeleteGLHandle(pfObject *obj);
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfCurve2d 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 pfCurve2d 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 pfCurve2d 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 pfCurve2d 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
2-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.
Page 3
pfCurve2d(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfCurve2d(3pf)
pfGetCurve2dClassType returns the pfType* for the class pfCurve2d. The
pfType* returned by pfGetCurve2dClassType is the same as the pfType*
returned by invoking pfGetType on any instance of class pfCurve2d.
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.
pfNewCurve2d creates an instance of an pfCurve2d. By default the
parametric domain is defined as [0..1].
pfCurve2dBeginT 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.
pfCurve2dEndT 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.
pfGetCurve2dBeginT Returns the beginning value of the parametric domain.
pfGetCurve2dEndT Returns the ending value of the parametric domain.
pfCurve2dSetClosed 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.
pfGetCurve2dClosed Returns the current value of the curve's end point
disposition.
pfCurve2dClosedTol Sets the tolerance used to determine when a curve is
closed. By default, this value is set by pfRep::subtractiveTol.
pfGetCurve2dClosedTol Returns the tolerance used to determine when a
curve is closed. By default this value is set pfRep::subtractiveTol.
pfCurve2dEvalPt 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.
pfCurve2dEvalTan 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:
Page 4
pfCurve2d(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfCurve2d(3pf)
tan = (f(t + dt) - f(t - dt)) / (2.0 * dt)
where f is the point-valued curve function.
pfCurve2dEvalNorm 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:
tan = (f'(t + dt) - f'(t - dt)) / (2.0 * dt)
where f' is the vector valued tangent function.
pfCurve2dEvalCurv 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||)
pfCurve2dEvalAll 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:
pfCurve2dEvalPt, pfCurve2dEvalTan, pfCurve2dEvalNorm, pfCurve2dEvalCurv.
SEE ALSO
pfRep, pfGeode
Page 5