pfSeg(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfSeg(3pf)NAME
pfSeg, pfTriIsectSeg - Set and operate on line segments
FUNCTION SPECIFICATION
#include <Performer/pr/pfGeoMath.h>
pfSeg::pfSeg();
pfSeg(const pfVec3& p1, const pfVec3& p2);
pfSeg(const pfVec3& _pos, float azi, float elev, float len);
pfSeg(const pfVec3& _pos, const pfVec3& _dir, float _length);
void pfSeg::clip(const pfSeg *seg, float d1, float d2);
void pfSeg::makePts(const pfVec3 &p1, const pfVec3 &p2);
void pfSeg::makePolar(const pfVec3 &pos, float azi, float elev,
float len);
int pfSeg::closestPtsOn(const pfSeg *seg2, pfVec3 &ptOn1,
pfVec3 &ptOn2);
int pfTriIsectSeg(const pfVec3 v1, const pfVec3 v2, const pfVec3 v3,
const pfSeg *seg, float *d);
struct pfSeg
{
pfVec3 pos;
pfVec3 dir;
float length;
};
DESCRIPTION
A pfSeg represents a line segment starting at pos, extending for a length
length in the direction dir. The routines assume that dir is of unit
length, otherwise the results are undefined. pfSeg is a public struct
whose data members pos, dir and length may be operated on directly.
The default constructor pfSeg() is empty and does no initialization.
There are also three other constructors to initialize the pfSeg from two
points , polar coordinates, or position/direction/length. These
constructors correspond directly to makePts, makePolar, and direct
initialization. new(arena) allocates a pfSeg from the specified memory
arena, or from the heap if arena is NULL. new allocates a pfSeg from the
default memory arena (see pfGetSharedArena). pfSegs can also be created
automatically on the stack or statically. pfSegs allocated with new can
be deleted with delete or pfDelete.
Page 1
pfSeg(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfSeg(3pf)
pfSeg::clip is used to select a subset of the pfSeg. It sets dst to the
portion of the pfSegment clipped to start at distance d1 and end at d2.
When d1 = 0 and d2 = seg->length, pfSeg::clip returns the original
segment. Values of d1 < 0 and d2 > seg->length can be used to extend the
segment.
pfSeg::makePts sets the pfSeg to the segment which starts at the point p1
and ends at the point p2.
pfSeg::makePolar sets the pfSeg to the segment which starts at pos and
has length length and points in the direction specified by azi and elev.
azi specifies the azimuth (or heading), which is the angle which the
projection of the segment in the X-Y plane makes with the +Y axis. elev
specifies the elevation (or pitch), the angle with respect to the X-Y
plane. The positive Y axis is azi=0 and elev=0. Azimuth follows the
right hand rule about the Z axis, i.e. +90 degrees is the -X axis.
Similarly, elevation follows the right hand rule about the X axis, i.e.
+90 degrees is the +Z axis.
pfSeg::closestPtsOn returns the two closest points on the implicit pfSeg
and seg2. If the two segments are parallel FALSE is returned and the
contents of ptOn1 and ptOn2 are undefined.
pfTriIsectSeg tests the line segment seg for intersection with the
triangle defined by the three vertices v1, v2, and v3. pfTriIsectSeg
returns TRUE or FALSE. If d is non-null, on return it contains the
length position of the intersection between 0 and seg->length.
SEE ALSO
pfNodeIsectSegs, pfGSetIsectSegs, pfVec3
Page 2