Graphene.Plane¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
constant |
r |
||
normal |
r |
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
. UseGraphene.Plane.free
() to free the resources allocated by this function- Return type:
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
) – aGraphene.Point3D
- Returns:
the distance of the given
Graphene.Point3D
from the plane- Return type:
Computes the distance of point from a
Graphene.Plane
.New in version 1.2.
- equal(b)¶
- Parameters:
b (
Graphene.Plane
) – aGraphene.Plane
- Returns:
true
if the given planes are equal- Return type:
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:
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
orNone
) – a unit length normal vector defining the plane pointing towards the origin; if unset, we use the X axis by defaultconstant (
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:
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
) – aGraphene.Plane
- Returns:
the initialized plane
- Return type:
Initializes the given
Graphene.Plane
using the normal vector and constant of anotherGraphene.Plane
.New in version 1.2.
- init_from_point(normal, point)¶
- Parameters:
normal (
Graphene.Vec3
) – a normal vector defining the plane pointing towards the originpoint (
Graphene.Point3D
) – aGraphene.Point3D
- Returns:
the initialized plane
- Return type:
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:
a (
Graphene.Point3D
) – aGraphene.Point3D
b (
Graphene.Point3D
) – aGraphene.Point3D
c (
Graphene.Point3D
) – aGraphene.Point3D
- Returns:
the initialized plane
- Return type:
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
) – aGraphene.Vec4
containing the normal vector in its first three components, and the distance in its fourth component- Returns:
the initialized plane
- Return type:
Initializes the given
Graphene.Plane
using the components of the givenGraphene.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:
matrix (
Graphene.Matrix
) – aGraphene.Matrix
normal_matrix (
Graphene.Matrix
orNone
) – aGraphene.Matrix
- 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.