pfSeg(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfSeg(3pf)NAME
pfClipSeg, pfMakePtsSeg, pfMakePolarSeg, pfClosestPtsOnSeg, pfTriIsectSeg
- Set and operate on line segments
FUNCTION SPECIFICATION
#include <Performer/pr.h>
void pfClipSeg(pfSeg *dst, const pfSeg *seg, float d1, float d2);
void pfMakePtsSeg(pfSeg *dst, const pfVec3 p1, const pfVec3 p2);
void pfMakePolarSeg(pfSeg *dst, const pfVec3 pos, float azi,
float elev, float len);
int pfClosestPtsOnSeg(const pfSeg *seg1, const pfSeg *seg2,
pfVec3 ptOn1, pfVec3 ptOn2);
int pfTriIsectSeg(const pfVec3 v1, const pfVec3 v2, const pfVec3 v3,
const pfSeg *seg, float *d);
typedef struct
{
pfVec3 pos;
pfVec3 dir;
float length;
} pfSeg;
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.
pfClipSeg is used to select a subset of the input segment seg. It sets
dst to the portion of segment seg clipped to start at distance d1 and end
at d2. When d1 = 0 and d2 = seg->length, pfClipSeg returns the original
segment. Values of d1 < 0 and d2 > seg->length can be used to extend the
segment.
pfMakePtsSeg sets dst to the segment which starts at the point p1 and
ends at the point p2.
pfMakePolarSeg sets dst 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
Page 1
pfSeg(3pf) OpenGL Performer 3.2.2 libpr C Reference Pages pfSeg(3pf)
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.
pfClosestPtsOnSeg returns the two closest points on the two segments seg1
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