pfPlane(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfPlane(3pf)NAMEpfPlane - Set and operate on planes
FUNCTION SPECIFICATION
#include <Performer/pr/pfGeoMath.h>
void* pfPlane::operator new(size_t);
void* pfPlane::operator new(size_t, void *arena);
pfPlane::pfPlane();
pfPlane(const pfVec3& p1, const pfVec3& p2, const pfVec3& p3);
pfPlane(const pfVec3& _norm, const pfVec3& _pos);
pfPlane(const pfVec3& _norm, float _offset);
void pfPlane::makePts(const pfVec3 &pt1, const pfVec3 &pt2,
const pfVec3 &pt3);
void pfPlane::makeNormPt(const pfVec3 &norm, const pfVec3 &pos);
void pfPlane::displace(float d);
void pfPlane::closestPtOn(const pfVec3 &pt, pfVec3 &dst);
int pfPlane::isect(const pfSeg *seg, float *d);
int pfPlane::isect(const pfSeg* seg, float* d1, float* d2);
int pfPlane::contains(const pfVec3 &pt);
int pfPlane::contains(const pfBox *box);
int pfPlane::contains(const pfSphere *sph);
int pfPlane::contains(const pfCylinder *cyl);
void pfPlane::orthoXform(const pfPlane *pln, const pfMatrix &xform);
struct pfPlane
{
pfVec3 normal;
float offset;
};
Page 1
pfPlane(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfPlane(3pf)DESCRIPTION
A pfPlane represents an infinite 2D plane as a normal and a distance
offset from the origin in the normal direction. A point on the plane
satisfies the equation normal dot (x, y, z) = offset. pfPlane is a
public struct whose data members normal and offset may be operated on
directly.
The default constructor pfPlane() is empty and does no initialization.
There are also three other constructors to construct a plane from three
points, a normal and a point, and a normal and an offset from the origin.
These constructors correspond directly with makePts, makeNormPt, and
direct initialization. new(arena) allocates a pfPlane from the specified
memory arena, or from the heap if arena is NULL. new allocates a pfPlane
from the default memory arena (see pfGetSharedArena). pfPlanes can also
be created automatically on the stack or statically. pfPlanes allocated
with new can be deleted with delete or pfDelete.
pfPlane::makePts sets the pfPlane to the plane which passes through the
three points pt1, pt2 and pt3.
pfPlane::makeNormPt sets the pfPlane to the plane which passes through
the point pt with normal norm.
pfPlane::displace moves the pfPlane by a distance d in the direction of
the plane normal.
pfPlane::closestPtOn sets the pfPlane to the closest point to pt which
lies in the plane pln. The line segment connecting pt and the pfPlane is
perpendicular to pln.
pfPlane::contains(const pfVec3) returns TRUE or FALSE depending on
whether the point given is in the interior of the specified half-space.
The half-space is defined with plane normal pointing to the exterior.
pfPlane::contains(const pfSphere *), pfPlane::contains(const pfBox *) and
pfPlane::contains(const pfCylinder *) test whether the half space
specified by pfPlane contains a non-empty portion of the volume specified
by the argument, a sphere, box or cylinder, respectively.
The return value from the these functions is the OR of one or more bit
fields. The returned value may be:
PFIS_FALSE:
The intersection of the primitive and the half space is empty.
PFIS_MAYBE:
The intersection of the primitive and the half space might be
non-empty.
PFIS_MAYBE | PFIS_TRUE:
The intersection of the primitive and the half space is
definitely non-empty.
Page 2
pfPlane(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfPlane(3pf)
PFIS_MAYBE | PFIS_TRUE | PFIS_ALL_IN:
The primitive is non-empty and lies entirely inside the half
space.
indicating indicate that the argument is entirely outside, potentially
partly inside, partially inside or entirely inside the half space
specified by the pfPlane.
pfPlane::isect tests the line segment seg for intersection with the half
space specified by the pfPlane. The possible test results are:
PFIS_FALSE:
seg lies entirely in the exterior.
PFIS_MAYBE | PFIS_TRUE | PFIS_START_IN:
The starting point of seg lies in the interior.
PFIS_MAYBE | PFIS_TRUE | PFIS_END_IN:
The ending point of seg lies in the interior.
If d is non-NULL, on return it contains the position along the line
segment (0 <= d <= seg->length) at which the intersection occurred.
pfPlane::isect intersects the line segment seg with the half space
specified by the pfPlane and has return values the same as pfPlane::isect
except that it also returns a non-zero value when both points are inside
the half-space. In this case it returns:
PFIS_MAYBE | PFIS_TRUE | PFIS_ALL_IN | PFIS_START_IN | PFIS_END_IN:
Both end points of seg lie in the interior.
If d1 and d2 are non-NULL, on return from pfPlane::isect they contain the
starting and ending positions of the line segment (0 <= d1 <= d2 <= seg-
>length) intersected with the half space.
pfPlane::orthoXform sets the pfPlane to the plane as transformed by the
orthogonal transformation xform; dst = pln * xform. If xform is not an
orthogonal transformation the results are undefined.
NOTES
The bit fields returned by the contains functions are structured so that
bitwise AND-ing the results of sequential tests can be used to compute
composite results, e.g. testing exclusion against a number of half
spaces.
C++ does not support array deletion (i.e. delete[]) for arrays of objects
allocated new operators that take additional arguments. Hence, the array
deletion operator delete[] should not be used on arrays of objects
created with new(arena) pfVec3[n].
Page 3
pfPlane(3pf) OpenGL Performer 3.2.2 libpr C++ Reference Pages pfPlane(3pf)SEE ALSO
pfBox, pfMatrix, pfSeg, pfSphere, pfVec3
Page 4