Panda3D
Public Member Functions | Static Public Member Functions

PlaneD Class Reference

An abstract mathematical description of a plane. More...

Inheritance diagram for PlaneD:
VBase4D

List of all members.

Public Member Functions

 PlaneD ()
 Creates a default plane.
 PlaneD (Point3D const a, Point3D const b, Point3D const c)
 Constructs a plane given three counter-clockwise points, as seen from the front of the plane (that is, viewed from the end of the normal vector, looking down).
 PlaneD (Vec3D const normal, Point3D const point)
 Constructs a plane given a surface normal vector and a point within the plane.
 PlaneD (double a, double b, double c, double d)
 Constructs a plane given the four terms of the plane equation.
 PlaneD (VBase4D const copy)
unsigned int addHash (unsigned int hash)
 Adds the vector into the running hash.
unsigned int addHash (unsigned int hash, double threshold)
 Adds the vector into the running hash.
 addToCell (int i, double value)
 addW (double value)
 addX (double value)
 addY (double value)
 addZ (double value)
bool almostEqual (VBase4D const other)
 Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.
bool almostEqual (VBase4D const other, double threshold)
 Returns true if two vectors are memberwise equal within a specified tolerance.
int compareTo (VBase4D const other, double threshold)
 Sorts vectors lexicographically, componentwise.
int compareTo (VBase4D const other)
 This flavor of compare_to uses a default threshold value based on the numeric type.
double distToPlane (Point3D const point)
 Returns the straight-line shortest distance from the point to the plane.
double dot (VBase4D const other)
 fill (double fill_value)
 Sets each element of the vector to the indicated fill_value.
VBase4D fmax (VBase4D const other)
VBase4D fmin (VBase4D const other)
PyObject getattr (string attr_name)
 This is used to implement swizzle masks.
double getCell (int i)
 getData ()
 Returns the address of the first of the four data elements in the vector.
unsigned int getHash ()
 Returns a suitable hash for phash_map.
unsigned int getHash (double threshold)
 Returns a suitable hash for phash_map.
Vec3D getNormal ()
 Returns the surface normal of the plane.
int getNumComponents ()
 Returns the number of elements in the vector, four.
Point3D getPoint ()
 Returns an arbitrary point in the plane.
Mat4D getReflectionMat ()
 This computes a transform matrix that reflects the universe to the other side of the plane, as in a mirror.
double getW ()
double getX ()
double getY ()
double getZ ()
bool intersectsLine (Point3D intersection_point, Point3D const p1, Point3D const p2)
 Returns true if the plane intersects the infinite line passing through points p1 and p2, false if the line is parallel.
bool intersectsPlane (Point3D from, Vec3D delta, PlaneD const other)
 Returns true if the two planes intersect, false if they do not.
bool isNan ()
 Returns true if any component of the vector is not-a-number, false otherwise.
double length ()
 Returns the length of the vector, by the Pythagorean theorem.
double lengthSquared ()
 Returns the square of the vector's length, cheap and easy.
bool normalize ()
 Normalizes the vector in place.
 operator new (unsigned int size)
bool operator!= (VBase4D const other)
VBase4D operator* (double scalar)
PlaneD operator* (Mat3D const mat)
 Transforms the plane by the indicated matrix.
PlaneD operator* (Mat4D const mat)
 Transforms the plane by the indicated matrix.
VBase4D operator*= (double scalar)
PlaneD operator*= (Mat4D const mat)
 Transforms the plane by the indicated matrix.
VBase4D operator+ (VBase4D const other)
VBase4D operator+= (VBase4D const other)
PlaneD operator- ()
 Returns the same plane facing the opposite direction.
VBase4D operator- (VBase4D const other)
VBase4D operator-= (VBase4D const other)
VBase4D operator/ (double scalar)
VBase4D operator/= (double scalar)
bool operator< (VBase4D const other)
 This performs a lexicographical comparison.
bool operator== (VBase4D const other)
 operator[] (int i)
double operator[] (int i)
 output (ostream out)
VBase4D project (VBase4D const onto)
 Returns a new vector representing the projection of this vector onto another one.
Point3D project (Point3D const point)
 Returns the point within the plane nearest to the indicated point in space.
 pythonRepr (ostream out, string class_name)
PyObject reduce (PyObject self)
 This special Python method is implement to provide support for the pickle module.
 set (double x, double y, double z, double w)
int setattr (PyObject self, string attr_name, PyObject assign)
 This is used to implement write masks.
 setCell (int i, double value)
 setitem (int i, double v)
 setW (double value)
 setX (double value)
 setY (double value)
 setZ (double value)
 write (ostream out)
 write (ostream out, int indent_level)
 xform (Mat4D const mat)
 Transforms the plane by the indicated matrix.

Static Public Member Functions

static TypeHandle getClassType ()
static int size ()
 Returns 4: the number of components of a LVecBase4.
static VBase4D const unitW ()
 Returns a unit W vector.
static VBase4D const unitX ()
 Returns a unit X vector.
static VBase4D const unitY ()
 Returns a unit Y vector.
static VBase4D const unitZ ()
 Returns a unit Z vector.
static VBase4D const zero ()
 Returns a zero-length vector.

Detailed Description

An abstract mathematical description of a plane.

A plane is defined by the equation Ax + By + Cz + D = 0.


Constructor & Destructor Documentation

PlaneD ( )

Creates a default plane.

This plane happens to intersect the origin, perpendicular to the Z axis. It's not clear how useful a default plane is.

PlaneD ( Point3D const  a,
Point3D const  b,
Point3D const  c 
)

Constructs a plane given three counter-clockwise points, as seen from the front of the plane (that is, viewed from the end of the normal vector, looking down).

PlaneD ( VBase4D const  copy)
PlaneD ( Vec3D const  normal,
Point3D const  point 
)

Constructs a plane given a surface normal vector and a point within the plane.

PlaneD ( double  a,
double  b,
double  c,
double  d 
)

Constructs a plane given the four terms of the plane equation.


Member Function Documentation

unsigned int addHash ( unsigned int  hash) [inherited]

Adds the vector into the running hash.

unsigned int addHash ( unsigned int  hash,
double  threshold 
) [inherited]

Adds the vector into the running hash.

addToCell ( int  i,
double  value 
) [inherited]
addW ( double  value) [inherited]
addX ( double  value) [inherited]
addY ( double  value) [inherited]
addZ ( double  value) [inherited]
bool almostEqual ( VBase4D const  other) [inherited]

Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type.

bool almostEqual ( VBase4D const  other,
double  threshold 
) [inherited]

Returns true if two vectors are memberwise equal within a specified tolerance.

int compareTo ( VBase4D const  other) [inherited]

This flavor of compare_to uses a default threshold value based on the numeric type.

int compareTo ( VBase4D const  other,
double  threshold 
) [inherited]

Sorts vectors lexicographically, componentwise.

Returns a number less than 0 if this vector sorts before the other one, greater than zero if it sorts after, 0 if they are equivalent (within the indicated tolerance).

double distToPlane ( Point3D const  point)

Returns the straight-line shortest distance from the point to the plane.

The returned value is positive if the point is in front of the plane (on the side with the normal), or negative in the point is behind the plane (on the opposite side from the normal). It's zero if the point is exactly in the plane.

double dot ( VBase4D const  other) [inherited]
fill ( double  fill_value) [inherited]

Sets each element of the vector to the indicated fill_value.

This is particularly useful for initializing to zero.

VBase4D fmax ( VBase4D const  other) [inherited]
VBase4D fmin ( VBase4D const  other) [inherited]
PyObject getattr ( string  attr_name) [inherited]

This is used to implement swizzle masks.

Reimplemented in Vec4D, and Point4D.

double getCell ( int  i) [inherited]
static TypeHandle getClassType ( ) [static, inherited]

Reimplemented in Vec4D, Point4D, QuatD, LRotationd, and LOrientationd.

getData ( ) [inherited]

Returns the address of the first of the four data elements in the vector.

The remaining elements occupy the next positions consecutively in memory.

unsigned int getHash ( ) [inherited]

Returns a suitable hash for phash_map.

unsigned int getHash ( double  threshold) [inherited]

Returns a suitable hash for phash_map.

Vec3D getNormal ( )

Returns the surface normal of the plane.

int getNumComponents ( ) [inherited]

Returns the number of elements in the vector, four.

Point3D getPoint ( )

Returns an arbitrary point in the plane.

This can be used along with the normal returned by get_normal() to reconstruct the plane.

Mat4D getReflectionMat ( )

This computes a transform matrix that reflects the universe to the other side of the plane, as in a mirror.

double getW ( ) [inherited]
double getX ( ) [inherited]
double getY ( ) [inherited]
double getZ ( ) [inherited]
bool intersectsLine ( Point3D  intersection_point,
Point3D const  p1,
Point3D const  p2 
)

Returns true if the plane intersects the infinite line passing through points p1 and p2, false if the line is parallel.

The points p1 and p2 are used only to define the Euclidean line; they have no other bearing on the intersection test. If true, sets intersection_point to the point of intersection.

bool intersectsPlane ( Point3D  from,
Vec3D  delta,
PlaneD const  other 
)

Returns true if the two planes intersect, false if they do not.

If they do intersect, then from and delta are filled in with the parametric representation of the line of intersection: that is, from is a point on that line, and delta is a vector showing the direction of the line.

bool isNan ( ) [inherited]

Returns true if any component of the vector is not-a-number, false otherwise.

double length ( ) [inherited]

Returns the length of the vector, by the Pythagorean theorem.

double lengthSquared ( ) [inherited]

Returns the square of the vector's length, cheap and easy.

bool normalize ( ) [inherited]

Normalizes the vector in place.

Returns true if the vector was normalized, false if it was a zero-length vector.

Reimplemented in QuatD.

operator new ( unsigned int  size) [inherited]
bool operator!= ( VBase4D const  other) [inherited]
VBase4D operator* ( double  scalar) [inherited]

Reimplemented in Vec4D, Point4D, QuatD, and LRotationd.

PlaneD operator* ( Mat4D const  mat)

Transforms the plane by the indicated matrix.

PlaneD operator* ( Mat3D const  mat)

Transforms the plane by the indicated matrix.

VBase4D operator*= ( double  scalar) [inherited]
PlaneD operator*= ( Mat4D const  mat)

Transforms the plane by the indicated matrix.

VBase4D operator+ ( VBase4D const  other) [inherited]

Reimplemented in Vec4D, and Point4D.

VBase4D operator+= ( VBase4D const  other) [inherited]
VBase4D operator- ( VBase4D const  other) [inherited]

Reimplemented in Vec4D, and Point4D.

PlaneD operator- ( )

Returns the same plane facing the opposite direction.

Reimplemented from VBase4D.

VBase4D operator-= ( VBase4D const  other) [inherited]
VBase4D operator/ ( double  scalar) [inherited]

Reimplemented in Vec4D, Point4D, QuatD, and LRotationd.

VBase4D operator/= ( double  scalar) [inherited]
bool operator< ( VBase4D const  other) [inherited]

This performs a lexicographical comparison.

It's of questionable mathematical meaning, but sometimes has a practical purpose for sorting unique vectors, especially in an STL container. Also see compare_to().

bool operator== ( VBase4D const  other) [inherited]
operator[] ( int  i) [inherited]
double operator[] ( int  i) [inherited]
output ( ostream  out)

Reimplemented from VBase4D.

VBase4D project ( VBase4D const  onto) [inherited]

Returns a new vector representing the projection of this vector onto another one.

The resulting vector will be a scalar multiple of onto.

Reimplemented in Vec4D, and Point4D.

Point3D project ( Point3D const  point)

Returns the point within the plane nearest to the indicated point in space.

pythonRepr ( ostream  out,
string  class_name 
) [inherited]

Reimplemented in Vec4D, and Point4D.

PyObject reduce ( PyObject  self) [inherited]

This special Python method is implement to provide support for the pickle module.

set ( double  x,
double  y,
double  z,
double  w 
) [inherited]
int setattr ( PyObject  self,
string  attr_name,
PyObject  assign 
) [inherited]

This is used to implement write masks.

Reimplemented in Vec4D, and Point4D.

setCell ( int  i,
double  value 
) [inherited]
setitem ( int  i,
double  v 
) [inherited]
setW ( double  value) [inherited]
setX ( double  value) [inherited]
setY ( double  value) [inherited]
setZ ( double  value) [inherited]
static int size ( ) [static, inherited]

Returns 4: the number of components of a LVecBase4.

static VBase4D const unitW ( ) [static, inherited]

Returns a unit W vector.

Reimplemented in Vec4D, and Point4D.

static VBase4D const unitX ( ) [static, inherited]

Returns a unit X vector.

Reimplemented in Vec4D, and Point4D.

static VBase4D const unitY ( ) [static, inherited]

Returns a unit Y vector.

Reimplemented in Vec4D, and Point4D.

static VBase4D const unitZ ( ) [static, inherited]

Returns a unit Z vector.

Reimplemented in Vec4D, and Point4D.

write ( ostream  out)
write ( ostream  out,
int  indent_level 
)
xform ( Mat4D const  mat)

Transforms the plane by the indicated matrix.

static VBase4D const zero ( ) [static, inherited]

Returns a zero-length vector.

Reimplemented in Vec4D, and Point4D.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties