Plane#

Added in version 1.2.

class Plane(*args, **kwargs)#

A 2D plane that extends infinitely in a 3D volume.

The contents of the graphene_plane_t are private, and should not be modified directly.

Constructors#

class Plane
classmethod alloc() Plane#

Allocates a new Plane structure.

The contents of the returned structure are undefined.

Added in version 1.2.

Methods#

class Plane
distance(point: Point3D) float#

Computes the distance of point from a Plane.

Added in version 1.2.

Parameters:

point – a Point3D

equal(b: Plane) bool#

Checks whether the two given Plane are equal.

Added in version 1.2.

Parameters:

b – a Plane

free() None#

Frees the resources allocated by alloc().

Added in version 1.2.

get_constant() float#

Retrieves the distance along the normal vector of the given Plane from the origin.

Added in version 1.2.

get_normal() Vec3#

Retrieves the normal vector pointing towards the origin of the given Plane.

Added in version 1.2.

init(normal: Vec3 | None, constant: float) Plane#

Initializes the given Plane using the given normal vector and constant values.

Added in version 1.2.

Parameters:
  • normal – a unit length normal vector defining the plane pointing towards the origin; if unset, we use the X axis by default

  • constant – the distance from the origin to the plane along the normal vector; the sign determines the half-space occupied by the plane

init_from_plane(src: Plane) Plane#

Initializes the given Plane using the normal vector and constant of another Plane.

Added in version 1.2.

Parameters:

src – a Plane

init_from_point(normal: Vec3, point: Point3D) Plane#

Initializes the given Plane using the given normal vector and an arbitrary co-planar point.

Added in version 1.2.

Parameters:
  • normal – a normal vector defining the plane pointing towards the origin

  • point – a Point3D

init_from_points(a: Point3D, b: Point3D, c: Point3D) Plane#

Initializes the given Plane using the 3 provided co-planar points.

The winding order is counter-clockwise, and determines which direction the normal vector will point.

Added in version 1.2.

Parameters:
init_from_vec4(src: Vec4) Plane#

Initializes the given Plane using the components of the given Vec4 vector.

Added in version 1.2.

Parameters:

src – a Vec4 containing the normal vector in its first three components, and the distance in its fourth component

negate() Plane#

Negates the normal vector and constant of a Plane, effectively mirroring the plane across the origin.

Added in version 1.2.

normalize() Plane#

Normalizes the vector of the given Plane, and adjusts the constant accordingly.

Added in version 1.2.

transform(matrix: Matrix, normal_matrix: Matrix | None = None) Plane#

Transforms a Plane p using the given matrix and normal_matrix.

If normal_matrix is None, a transformation matrix for the plane normal will be computed from matrix. If you are transforming multiple planes using the same matrix it’s recommended to compute the normal matrix beforehand to avoid incurring in the cost of recomputing it every time.

Added in version 1.10.

Parameters:

Fields#

class Plane
constant#
normal#