pfuGetClosestPoint(3pf) OpenGL Performer 3.2.2 libpfutil Reference Pages
NAMEpfuGetClosestPoint - Find closest point in a scene graph to a given
point.
FUNCTION SPECIFICATION
#include <Performer/pfutil.h>
extern int pfuGetClosestPoint(pfNode *node, float eyex, float eyey,
float eyez, const pfTexture *tex, int travmode,
float *x, float *y, float *z, float *s, float *t,
float *r);
DESCRIPTIONpfuGetClosestPoint traverses a scene graph looking for the closest point
(on any primitive decomposable into triangles) to the point given by
eyex, eyey, eyez, using the pfuTraverser mode given by travmode. If the
argument tex is not NULL, the traversal will be restricted to triangles
that are textured by the pfTexture pointed to by tex.
On success, the function returns 1 and vertex coordinates of the closest
point are returned in *x, *y, *z, and if tex is not NULL, the texture
coordinates of the closest point will be returned in *r, *s, *t. On
failure (there are no triangles, or, if tex != NULL, there are no
triangles textured by tex) pfuGetClosestPoint returns 0.
See the source code for the sample ".closest" pseudo-loader in
/usr/share/Performer/src/lib/libpfdb/libpfclosest for an example of
usage.
NOTES
The libpfutil source code, object code and documentation are provided as
unsupported software. Routines are subject to change in future releases.
BUGS
The implementation assumes that all coordinate scaling in pfSCS and pfDCS
nodes in the scene are uniform, i.e. that the scale factor is the same in
all three coordinate axis directions. If this is not the case, the
answer returned will be valid coordinates (and texture coordinates) of a
point on a triangle, but it may not be the actual closest point.
In the case of degenerate triangles the coordinates returned may not be
on or close to an object at all.
Point and line primitives are not traversed.
Interaction with automatic texture coordinate generation is very limited.
Only PFTG_OBJECT_LINEAR is supported, and then only when a pfTexGen is
explicitly attached to the pfGeoSet's pfGeoState.
Page 1
pfuGetClosestPoint(3pf) OpenGL Performer 3.2.2 libpfutil Reference Pages
SEE ALSO
pfuTraverser
Page 2