Graphene.Plane

Fields

Name

Type

Access

Description

constant

float

r

normal

Graphene.Vec3

r

Methods

class

alloc ()

distance (point)

equal (b)

free ()

get_constant ()

get_normal ()

init (normal, constant)

init_from_plane (src)

init_from_point (normal, point)

init_from_points (a, b, c)

init_from_vec4 (src)

negate ()

normalize ()

transform (matrix, normal_matrix)

Details

class Graphene.Plane

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.

New in version 1.2.

classmethod alloc()
Returns:

the newly allocated Graphene.Plane. Use Graphene.Plane.free() to free the resources allocated by this function

Return type:

Graphene.Plane

Allocates a new Graphene.Plane structure.

The contents of the returned structure are undefined.

New in version 1.2.

distance(point)
Parameters:

point (Graphene.Point3D) – a Graphene.Point3D

Returns:

the distance of the given Graphene.Point3D from the plane

Return type:

float

Computes the distance of point from a Graphene.Plane.

New in version 1.2.

equal(b)
Parameters:

b (Graphene.Plane) – a Graphene.Plane

Returns:

true if the given planes are equal

Return type:

bool

Checks whether the two given Graphene.Plane are equal.

New in version 1.2.

free()

Frees the resources allocated by Graphene.Plane.alloc().

New in version 1.2.

get_constant()
Returns:

the constant value of the plane

Return type:

float

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

New in version 1.2.

get_normal()
Returns:

return location for the normal vector

Return type:

normal: Graphene.Vec3

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

New in version 1.2.

init(normal, constant)
Parameters:
  • normal (Graphene.Vec3 or None) – a unit length normal vector defining the plane pointing towards the origin; if unset, we use the X axis by default

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

Returns:

the initialized plane

Return type:

Graphene.Plane

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

New in version 1.2.

init_from_plane(src)
Parameters:

src (Graphene.Plane) – a Graphene.Plane

Returns:

the initialized plane

Return type:

Graphene.Plane

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

New in version 1.2.

init_from_point(normal, point)
Parameters:
Returns:

the initialized plane

Return type:

Graphene.Plane

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

New in version 1.2.

init_from_points(a, b, c)
Parameters:
Returns:

the initialized plane

Return type:

Graphene.Plane

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

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

New in version 1.2.

init_from_vec4(src)
Parameters:

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

Returns:

the initialized plane

Return type:

Graphene.Plane

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

New in version 1.2.

negate()
Returns:

return location for the negated plane

Return type:

res: Graphene.Plane

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

New in version 1.2.

normalize()
Returns:

return location for the normalized plane

Return type:

res: Graphene.Plane

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

New in version 1.2.

transform(matrix, normal_matrix)
Parameters:
Returns:

the transformed plane

Return type:

res: Graphene.Plane

Transforms a Graphene.Plane self 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.

New in version 1.10.