Panda3D
Public Member Functions

Planed Class Reference

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

#include "plane.h"

Inheritance diagram for Planed:
LVecBase4d LVecBase4d

List of all members.

Public Member Functions

 Planed ()
 Creates a default plane.
 Planed (const LVecBase4d &copy)
 Planed (const LVector3d &normal, const LPoint3d &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 (const LVecBase4d &copy)
 Planed (const LPoint3d &a, const LPoint3d &b, const LPoint3d &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 (const LPoint3d &a, const LPoint3d &b, const LPoint3d &c)
 Planed (const LVector3d &normal, const LPoint3d &point)
 Planed (double a, double b, double c, double d)
double dist_to_plane (const LPoint3d &point) const
double dist_to_plane (const LPoint3d &point) const
 Returns the straight-line shortest distance from the point to the plane.
LVector3d get_normal () const
LVector3d get_normal () const
 Returns the surface normal of the plane.
LPoint3d get_point () const
LPoint3d get_point () const
 Returns an arbitrary point in the plane.
LMatrix4d get_reflection_mat () const
LMatrix4d get_reflection_mat () const
 This computes a transform matrix that reflects the universe to the other side of the plane, as in a mirror.
bool intersects_line (LPoint3d &intersection_point, const LPoint3d &p1, const LPoint3d &p2) const
 Returns true if the plane intersects the infinite line passing through points p1 and p2, false if the line is parallel.
bool intersects_line (double &t, const LPoint3d &from, const LVector3d &delta) const
 This flavor of intersects_line() returns a bit more information about the nature of the intersecting point.
bool intersects_line (LPoint3d &intersection_point, const LPoint3d &p1, const LPoint3d &p2) const
bool intersects_line (double &t, const LPoint3d &from, const LVector3d &delta) const
bool intersects_parabola (double &t1, double &t2, const Parabolad &parabola) const
 Determines whether and where the indicated parabola intersects with the plane.
bool intersects_parabola (double &t1, double &t2, const Parabolad &parabola) const
bool intersects_plane (LPoint3d &from, LVector3d &delta, const Planed &other) const
bool intersects_plane (LPoint3d &from, LVector3d &delta, const Planed &other) const
 Returns true if the two planes intersect, false if they do not.
Planed operator* (const LMatrix3d &mat) const
 Transforms the plane by the indicated matrix.
Planed operator* (const LMatrix3d &mat) const
Planed operator* (const LMatrix4d &mat) const
Planed operator* (const LMatrix4d &mat) const
 Transforms the plane by the indicated matrix.
void operator*= (const LMatrix4d &mat)
void operator*= (const LMatrix4d &mat)
 Transforms the plane by the indicated matrix.
Planed operator- () const
 Returns the same plane facing the opposite direction.
Planed operator- () const
void output (ostream &out) const
void output (ostream &out) const
LPoint3d project (const LPoint3d &point) const
 Returns the point within the plane nearest to the indicated point in space.
LPoint3d project (const LPoint3d &point) const
void write (ostream &out, int indent_level=0) const
void write (ostream &out, int indent_level=0) const
void xform (const LMatrix4d &mat)
 Transforms the plane by the indicated matrix.
void xform (const LMatrix4d &mat)

Detailed Description

An abstract mathematical description of a plane.

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

Definition at line 49 of file plane.h.


Constructor & Destructor Documentation

Planed::Planed ( ) [inline]

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.

Definition at line 119 of file plane.h.

Planed::Planed ( const LPoint3d a,
const LPoint3d b,
const LPoint3d c 
) [inline]

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

Definition at line 146 of file plane.h.

Planed::Planed ( const LVector3d normal,
const LPoint3d point 
) [inline]

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

Definition at line 165 of file plane.h.

Planed::Planed ( double  a,
double  b,
double  c,
double  d 
) [inline]

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

Definition at line 182 of file plane.h.


Member Function Documentation

double Planed::dist_to_plane ( const LPoint3d point) const [inline]

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.

Definition at line 261 of file plane.h.

Referenced by EggPolygon::is_planar().

LVector3d Planed::get_normal ( ) const [inline]

Returns the surface normal of the plane.

Definition at line 246 of file plane.h.

LPoint3d Planed::get_point ( ) const

Returns an arbitrary point in the plane.

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

Definition at line 66 of file plane.cxx.

LMatrix4d Planed::get_reflection_mat ( ) const

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

Definition at line 41 of file plane.cxx.

bool Planed::intersects_line ( LPoint3d intersection_point,
const LPoint3d p1,
const LPoint3d p2 
) const [inline]

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.

Definition at line 287 of file plane.h.

bool Planed::intersects_line ( double &  t,
const LPoint3d from,
const LVector3d delta 
) const [inline]

This flavor of intersects_line() returns a bit more information about the nature of the intersecting point.

The line is defined via the parametric equation from + t * delta for all real values of t.

If there is no intersection with the plane, the function returns false and leaves t undefined. If there is an intersection with the plane, the function returns true and sets t to the parametric value that defines the point of intersection. That is, t == 0.0f implies that the intersection occurred exactly at point from, and t == 1.0f implies at point from + delta, with other values of t accordingly.

Definition at line 316 of file plane.h.

bool Planed::intersects_parabola ( double &  t1,
double &  t2,
const Parabolad parabola 
) const

Determines whether and where the indicated parabola intersects with the plane.

If there is no intersection with the plane, the function returns false and leaves t1 and t2 undefined. If there is an intersection with the plane, the function returns true and sets t1 and t2 to the parametric value that defines the two points of intersection. If the parabola is exactly tangent to the plane, then t1 == t2.

Definition at line 134 of file plane.cxx.

bool Planed::intersects_plane ( LPoint3d from,
LVector3d delta,
const Planed other 
) const

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.

Definition at line 92 of file plane.cxx.

Planed Planed::operator* ( const LMatrix4d mat) const [inline]

Transforms the plane by the indicated matrix.

Definition at line 204 of file plane.h.

Planed Planed::operator* ( const LMatrix3d mat) const [inline]

Transforms the plane by the indicated matrix.

Definition at line 193 of file plane.h.

void Planed::operator*= ( const LMatrix4d mat) [inline]

Transforms the plane by the indicated matrix.

Definition at line 216 of file plane.h.

Planed Planed::operator- ( ) const [inline]

Returns the same plane facing the opposite direction.

Reimplemented from LVecBase4d.

Definition at line 236 of file plane.h.

LPoint3d Planed::project ( const LPoint3d point) const [inline]

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

Definition at line 272 of file plane.h.

void Planed::xform ( const LMatrix4d mat) [inline]

Transforms the plane by the indicated matrix.

Definition at line 226 of file plane.h.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations