Panda3D
Public Member Functions | List of all members
LPlaned Class Reference

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

Inheritance diagram for LPlaned:
LVecBase4d

Public Member Functions

 __init__ ()
 Creates a default plane. More...
 
 __init__ (const LPlaned)
 
 __init__ (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). More...
 
 __init__ (const LVecBase4d copy)
 
 __init__ (const LVector3d normal, const LPoint3d point)
 Constructs a plane given a surface normal vector and a point within the plane. More...
 
 __init__ (double a, double b, double c, double d)
 Constructs a plane given the four terms of the plane equation. More...
 
double distToPlane (const LPoint3d point)
 Returns the straight-line shortest distance from the point to the plane. More...
 
 flip ()
 Convenience method that flips the plane in-place. More...
 
LVector3d getNormal ()
 Returns the surface normal of the plane. More...
 
LPoint3d getPoint ()
 Returns an arbitrary point in the plane. More...
 
LMatrix4d getReflectionMat ()
 This computes a transform matrix that reflects the universe to the other side of the plane, as in a mirror. More...
 
bool intersectsLine (LPoint3d intersection_point, const LPoint3d p1, const LPoint3d p2)
 Returns true if the plane intersects the infinite line passing through points p1 and p2, false if the line is parallel. More...
 
bool intersectsPlane (LPoint3d from, LVector3d delta, const LPlaned other)
 Returns true if the two planes intersect, false if they do not. More...
 
bool normalize ()
 Normalizes the plane in place. More...
 
LPlaned normalized ()
 Normalizes the plane and returns the normalized plane as a copy. More...
 
LPlaned operator * (const LMatrix3d mat)
 
LPlaned operator * (const LMatrix4d mat)
 
LPlaned operator *= (const LMatrix4d mat)
 
LPlaned operator - ()
 
 output (Ostream out)
 
LPoint3d project (const LPoint3d point)
 Returns the point within the plane nearest to the indicated point in space. More...
 
 write (Ostream out, int indent_level)
 
 xform (const LMatrix4d mat)
 Transforms the plane by the indicated matrix. More...
 
- Public Member Functions inherited from LVecBase4d
object __getattr__ (str attr_name)
 
 __init__ ()
 
 __init__ (const LPoint3d point)
 Constructs an LVecBase4 from an LPoint3. More...
 
 __init__ (const LVecBase3d copy, double w)
 
 __init__ (const LVecBase4d)
 
 __init__ (const LVector3d vector)
 Constructs an LVecBase4 from an LVector3. More...
 
 __init__ (const UnalignedLVecBase4d copy)
 
 __init__ (double fill_value)
 
 __init__ (double x, double y, double z, double w)
 
object __ipow__ (double exponent)
 
LVecBase4d __pow__ (double exponent)
 
object __reduce__ ()
 
str __repr__ ()
 
int __setattr__ (str attr_name, object assign)
 
int addHash (int hash)
 Adds the vector into the running hash. More...
 
int addHash (int hash, double threshold)
 Adds the vector into the running hash. More...
 
 addToCell (int i, double value)
 
 addW (double value)
 
 addX (double value)
 
 addY (double value)
 
 addZ (double value)
 
bool almostEqual (const LVecBase4d other)
 Returns true if two vectors are memberwise equal within a default tolerance based on the numeric type. More...
 
bool almostEqual (const LVecBase4d other, double threshold)
 Returns true if two vectors are memberwise equal within a specified tolerance. More...
 
int compareTo (const LVecBase4d other)
 This flavor of compare_to uses a default threshold value based on the numeric type. More...
 
int compareTo (const LVecBase4d other, double threshold)
 Sorts vectors lexicographically, componentwise. More...
 
 componentwiseMult (const LVecBase4d other)
 
double dot (const LVecBase4d other)
 
 fill (double fill_value)
 Sets each element of the vector to the indicated fill_value. More...
 
LVecBase4d fmax (const LVecBase4d other)
 
LVecBase4d fmin (const LVecBase4d other)
 
 generateHash (ChecksumHashGenerator hashgen)
 Adds the vector to the indicated hash generator. More...
 
 generateHash (ChecksumHashGenerator hashgen, double threshold)
 Adds the vector to the indicated hash generator. More...
 
double getCell (int i)
 
 getData ()
 Returns the address of the first of the four data elements in the vector. More...
 
int getHash ()
 Returns a suitable hash for phash_map. More...
 
int getHash (double threshold)
 Returns a suitable hash for phash_map. More...
 
double getW ()
 
double getX ()
 
LVecBase2d getXy ()
 Returns the x and y component of this vector. More...
 
LVecBase3d getXyz ()
 Returns the x, y and z component of this vector. More...
 
double getY ()
 
double getZ ()
 
bool isNan ()
 Returns true if any component of the vector is not-a-number, false otherwise. More...
 
double length ()
 Returns the length of the vector, by the Pythagorean theorem. More...
 
double lengthSquared ()
 Returns the square of the vector's length, cheap and easy. More...
 
bool normalize ()
 Normalizes the vector in place. More...
 
LVecBase4d normalized ()
 Normalizes the vector and returns the normalized vector as a copy. More...
 
bool operator != (const LVecBase4d other)
 
LVecBase4d operator * (double scalar)
 
LVecBase4d operator *= (double scalar)
 
LVecBase4d operator - ()
 
LVecBase4d operator - (const LVecBase4d other)
 
LVecBase4d operator -= (const LVecBase4d other)
 
 operator [] (int i, double assign_val)
 
double operator [] (int i)
 
 operator new (int size)
 
LVecBase4d operator+ (const LVecBase4d other)
 
LVecBase4d operator+= (const LVecBase4d other)
 
LVecBase4d operator/ (double scalar)
 
LVecBase4d operator/= (double scalar)
 
bool operator< (const LVecBase4d other)
 
LVecBase4d operator= (const LVecBase4d copy)
 
LVecBase4d operator= (double fill_value)
 
bool operator== (const LVecBase4d other)
 
 output (Ostream out)
 
LVecBase4d project (const LVecBase4d onto)
 Returns a new vector representing the projection of this vector onto another one. More...
 
 readDatagram (DatagramIterator source)
 Reads the vector from the Datagram using get_stdfloat(). More...
 
 readDatagramFixed (DatagramIterator source)
 Reads the vector from the Datagram using get_float32() or get_float64(). More...
 
 set (double x, double y, double z, double w)
 
 setCell (int i, double value)
 
 setW (double value)
 
 setX (double value)
 
 setY (double value)
 
 setZ (double value)
 
 writeDatagram (Datagram destination)
 Writes the vector to the Datagram using add_stdfloat(). More...
 
 writeDatagramFixed (Datagram destination)
 Writes the vector to the Datagram using add_float32() or add_float64(), depending on the type of floats in the vector, regardless of the setting of Datagram::set_stdfloat_double(). More...
 

Additional Inherited Members

- Public Types inherited from LVecBase4d
enum  { num_components = 4, is_int = 0 }
 
- Static Public Member Functions inherited from LVecBase4d
static TypeHandle getClassType ()
 
static int getNumComponents ()
 
static int size ()
 
static const LVecBase4d unitW ()
 Returns a unit W vector. More...
 
static const LVecBase4d unitX ()
 Returns a unit X vector. More...
 
static const LVecBase4d unitY ()
 Returns a unit Y vector. More...
 
static const LVecBase4d unitZ ()
 Returns a unit Z vector. More...
 
static const LVecBase4d zero ()
 Returns a zero-length vector. More...
 
- Public Attributes inherited from LVecBase4d
double x
 
LVecBase2d xy
 Returns the x and y component of this vector. More...
 
LVecBase3d xyz
 Returns the x, y and z component of this vector. More...
 
double y
 
double z
 

Detailed Description

An abstract mathematical description of a plane.

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

Member Function Documentation

◆ __init__() [1/6]

__init__ ( )

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.

◆ __init__() [2/6]

__init__ ( const  LPlaned)

◆ __init__() [3/6]

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

◆ __init__() [4/6]

__init__ ( const LVecBase4d  copy)

◆ __init__() [5/6]

__init__ ( const LVector3d  normal,
const LPoint3d  point 
)

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

◆ __init__() [6/6]

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

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

◆ distToPlane()

double distToPlane ( const LPoint3d  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()

flip ( )

Convenience method that flips the plane in-place.

This is done by simply flipping the normal vector.

◆ getNormal()

LVector3d getNormal ( )

Returns the surface normal of the plane.

◆ getPoint()

LPoint3d getPoint ( )

Returns an arbitrary point in the plane.

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

◆ getReflectionMat()

LMatrix4d getReflectionMat ( )

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

◆ intersectsLine()

bool intersectsLine ( LPoint3d  intersection_point,
const LPoint3d  p1,
const LPoint3d  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.

◆ intersectsPlane()

bool intersectsPlane ( LPoint3d  from,
LVector3d  delta,
const LPlaned  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.

◆ normalize()

bool normalize ( )

Normalizes the plane in place.

Returns true if the plane was normalized, false if the plane had a zero-length normal vector.

◆ normalized()

LPlaned normalized ( )

Normalizes the plane and returns the normalized plane as a copy.

If the plane's normal was a zero-length vector, the same plane is returned.

◆ operator *() [1/2]

LPlaned operator * ( const LMatrix3d  mat)

◆ operator *() [2/2]

LPlaned operator * ( const LMatrix4d  mat)

◆ operator *=()

LPlaned operator *= ( const LMatrix4d  mat)

◆ operator -()

LPlaned operator - ( )

◆ output()

output ( Ostream  out)

◆ project()

LPoint3d project ( const LPoint3d  point)

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

◆ write()

write ( Ostream  out,
int  indent_level 
)

◆ xform()

xform ( const LMatrix4d  mat)

Transforms the plane by the indicated matrix.