Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Member Functions
LPlanef Class Reference

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

Inheritance diagram for LPlanef:
VBase4

List of all members.

Public Member Functions

 LPlanef ()
 Creates a default plane.
 LPlanef (Point3 const a, Point3 const b, Point3 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).
 LPlanef (VBase4 const copy)
 LPlanef (Vec3 const normal, Point3 const point)
 Constructs a plane given a surface normal vector and a point within the plane.
 LPlanef (float a, float b, float c, float d)
 Constructs a plane given the four terms of the plane equation.
float distToPlane (Point3 const point)
 Returns the straight-line shortest distance from the point to the plane.
 flip ()
 Convenience method that flips the plane in-place.
Vec3 getNormal ()
 Returns the surface normal of the plane.
Point3 getPoint ()
 Returns an arbitrary point in the plane.
Mat4 getReflectionMat ()
 This computes a transform matrix that reflects the universe to the other side of the plane, as in a mirror.
bool intersectsLine (Point3 intersection_point, Point3 const p1, Point3 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 (Point3 from, Vec3 delta, LPlanef const other)
 Returns true if the two planes intersect, false if they do not.
LPlanef operator* (Mat3 const mat)
 Transforms the plane by the indicated matrix.
LPlanef operator* (Mat4 const mat)
 Transforms the plane by the indicated matrix.
LPlanef operator*= (Mat4 const mat)
 Transforms the plane by the indicated matrix.
LPlanef operator- ()
 Returns the same plane facing the opposite direction.
 output (ostream out)
Point3 project (Point3 const point)
 Returns the point within the plane nearest to the indicated point in space.
 write (ostream out, int indent_level)
 write (ostream out)
 xform (Mat4 const mat)
 Transforms the plane by the indicated matrix.

Detailed Description

An abstract mathematical description of a plane.

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


Constructor & Destructor Documentation

LPlanef ( )

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.

LPlanef ( Point3 const  a,
Point3 const  b,
Point3 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).

LPlanef ( VBase4 const  copy)
LPlanef ( Vec3 const  normal,
Point3 const  point 
)

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

LPlanef ( float  a,
float  b,
float  c,
float  d 
)

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


Member Function Documentation

float distToPlane ( Point3 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.

flip ( )

Convenience method that flips the plane in-place.

This is done by simply flipping the normal vector.

Returns the surface normal of the plane.

Returns an arbitrary point in the plane.

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

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

bool intersectsLine ( Point3  intersection_point,
Point3 const  p1,
Point3 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 ( Point3  from,
Vec3  delta,
LPlanef 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.

LPlanef operator* ( Mat3 const  mat)

Transforms the plane by the indicated matrix.

LPlanef operator* ( Mat4 const  mat)

Transforms the plane by the indicated matrix.

LPlanef operator*= ( Mat4 const  mat)

Transforms the plane by the indicated matrix.

LPlanef operator- ( )

Returns the same plane facing the opposite direction.

Reimplemented from VBase4.

output ( ostream  out)

Reimplemented from VBase4.

Point3 project ( Point3 const  point)

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

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

Transforms the plane by the indicated matrix.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties