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

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

Inheritance diagram for LPlaned:
VBase4D

List of all members.

Public Member Functions

 LPlaned ()
 Creates a default plane.
 LPlaned (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).
 LPlaned (VBase4D const copy)
 LPlaned (Vec3D const normal, Point3D const point)
 Constructs a plane given a surface normal vector and a point within the plane.
 LPlaned (double a, double b, double c, double d)
 Constructs a plane given the four terms of the plane equation.
double distToPlane (Point3D const point)
 Returns the straight-line shortest distance from the point to the plane.
 flip ()
 Convenience method that flips the plane in-place.
Vec3D getNormal ()
 Returns the surface normal of the plane.
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.
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, LPlaned const other)
 Returns true if the two planes intersect, false if they do not.
LPlaned operator* (Mat3D const mat)
 Transforms the plane by the indicated matrix.
LPlaned operator* (Mat4D const mat)
 Transforms the plane by the indicated matrix.
LPlaned operator*= (Mat4D const mat)
 Transforms the plane by the indicated matrix.
LPlaned operator- ()
 Returns the same plane facing the opposite direction.
 output (ostream out)
Point3D project (Point3D 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 (Mat4D 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

LPlaned ( )

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.

LPlaned ( 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).

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

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

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

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


Member Function Documentation

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.

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 ( 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,
LPlaned 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.

LPlaned operator* ( Mat3D const  mat)

Transforms the plane by the indicated matrix.

LPlaned operator* ( Mat4D const  mat)

Transforms the plane by the indicated matrix.

LPlaned operator*= ( Mat4D const  mat)

Transforms the plane by the indicated matrix.

LPlaned operator- ( )

Returns the same plane facing the opposite direction.

Reimplemented from VBase4D.

output ( ostream  out)

Reimplemented from VBase4D.

Point3D project ( Point3D 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 ( Mat4D const  mat)

Transforms the plane by the indicated matrix.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties