panda3d.core.LPlanef¶

from panda3d.core import LPlanef

class LPlanef

Bases: LVecBase4f

An abstract mathematical description of a plane. A plane is defined by the equation Ax + By + Cz + D = 0.

Inheritance diagram

__init__() → None

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__(param0: LPlanef) → None
__init__(a: LPoint3f, b: LPoint3f, c: LPoint3f) → None

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__(copy: LVecBase4f) → None
__init__(normal: LVector3f, point: LPoint3f) → None

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

__init__(a: float, b: float, c: float, d: float) → None

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

xform(mat: LMatrix4f) → None

Transforms the plane by the indicated matrix.

getReflectionMat() → LMatrix4f

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

Return type

LMatrix4f

getNormal() → LVector3f

Returns the surface normal of the plane.

Return type

LVector3f

getPoint() → LPoint3f

Returns an arbitrary point in the plane. This can be used along with the normal returned by getNormal() to reconstruct the plane.

Return type

LPoint3f

distToPlane(point: LPoint3f) → float

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.

normalize() → bool

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

normalized() → LPlanef

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.

Return type

LPlanef

project(point: LPoint3f) → LPoint3f

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

Return type

LPoint3f

flip() → None

Convenience method that flips the plane in-place. This is done by simply flipping the normal vector.

intersectsLine(intersection_point: LPoint3f, p1: LPoint3f, p2: LPoint3f) → bool

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(from: LPoint3f, delta: LVector3f, other: LPlanef) → bool

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.

output(out: ostream) → None
write(out: ostream, indent_level: int) → None