Plane

class Plane3(c)[source]

Bases: object

Create a plane object from linear coefficients

Parameters:

c (Union[List[float], Tuple[float, float, float, float], ndarray[Tuple[ResizeEventType[4]], dtype[floating]]]) – Plane coefficients

Returns:

a Plane object

Return type:

Plane

Planes are represented by the 4-vector \([a, b, c, d]\) which describes the plane \(\pi: ax + by + cz + d=0\).

classmethod LinePoint(l, p)[source]

Create a plane object from a line and point

Parameters:
  • l (Line3) – 3D line

  • p (Union[List[float], Tuple[float, float, float], ndarray[Tuple[ResizeEventType[3]], dtype[floating]]]) – Points in the plane

Returns:

a Plane object

Return type:

Self

Seealso:

PointNormal() ThreePoints()

classmethod PointNormal(p, n)[source]

Create a plane object from point and normal

Parameters:
  • p (Union[List[float], Tuple[float, float, float], ndarray[Tuple[ResizeEventType[3]], dtype[floating]]]) – Point in the plane

  • n (Union[List[float], Tuple[float, float, float], ndarray[Tuple[ResizeEventType[3]], dtype[floating]]]) – Normal vector to the plane

Returns:

a Plane object

Return type:

Self

Seealso:

ThreePoints() LinePoint()

classmethod ThreePoints(p)[source]

Create a plane object from three points

Parameters:

p (ndarray[Tuple[ResizeEventType[3], ResizeEventType[3]], dtype[floating]]) – Three points in the plane

Returns:

a Plane object

Return type:

Self

The points in p are arranged as columns.

Seealso:

PointNormal() LinePoint()

classmethod TwoLines(l1, l2)[source]

Create a plane object from two line

Parameters:
Returns:

a Plane object

Return type:

Self

Warning

This algorithm fails if the lines are parallel.

Seealso:

LinePoint() PointNormal() ThreePoints()

static intersection(pi1, pi2, pi3)[source]

Intersection point of three planes

Parameters:
Returns:

coordinates of intersection point

Return type:

ndarray[Tuple[ResizeEventType[3]], dtype[floating]]

This static method computes the intersection point of the three planes given as arguments.

Warning

This algorithm fails if the planes do not intersect, or intersect along a line.

Seealso:

Plane()

__init__(c)[source]
contains(p, tol=20)[source]

Test if point in plane

Parameters:
  • p (Union[List[float], Tuple[float, float, float], ndarray[Tuple[ResizeEventType[3]], dtype[floating]]]) – A 3D point

  • tol (float) – tolerance in units of eps, defaults to 20

Returns:

if the point is in the plane

Return type:

bool

plot(bounds=None, ax=None, **kwargs)[source]

Plot plane

Parameters:
  • bounds (Union[float, List[float], Tuple[float, ...], ndarray[Any, dtype[floating]], None]) – bounds of plot volume, defaults to None

  • ax (Optional[Axes]) – 3D axes to plot into, defaults to None

  • kwargs – optional arguments passed to plot_surface

The bounds of the 3D plot volume is [xmin, xmax, ymin, ymax, zmin, zmax] and a 3D plot is created if not already existing. If bounds is not provided it is taken from current 3D axes.

The plane is drawn using plot_surface.

Seealso:

axes_logic()

property d: float

Plane offset

Returns:

Offset of the plane

Return type:

float

For a plane \(\pi: ax + by + cz + d=0\) this is the scalar \(d\).

Seealso:

n()

property n: ndarray[Tuple[Literal[3]], dtype[floating]]

Normal to the plane

Returns:

Normal to the plane

Return type:

ndarray(3)

For a plane \(\pi: ax + by + cz + d=0\) this is the vector \([a,b,c]\).

Seealso:

d()