Box
Added in version 1.2.
- class Box(*args, **kwargs)
A 3D box, described as the volume between a minimum and a maximum vertices.
Constructors
Methods
- class Box
- contains_box(b: Box) bool
Checks whether the
Box
a
contains the givenBox
b
.Added in version 1.2.
- Parameters:
b – a
Box
- contains_point(point: Point3D) bool
Checks whether
box
contains the givenpoint
.Added in version 1.2.
- Parameters:
point – the coordinates to check
- empty() Box
A degenerate
Box
that can only be expanded.The returned value is owned by Graphene and should not be modified or freed.
Added in version 1.2.
- equal(b: Box) bool
Checks whether the two given boxes are equal.
Added in version 1.2.
- Parameters:
b – a
Box
- expand(point: Point3D) Box
Expands the dimensions of
box
to include the coordinates atpoint
.Added in version 1.2.
- Parameters:
point – the coordinates of the point to include
- expand_scalar(scalar: float) Box
Expands the dimensions of
box
by the givenscalar
value.If
scalar
is positive, theBox
will grow; ifscalar
is negative, theBox
will shrink.Added in version 1.2.
- Parameters:
scalar – a scalar value
- expand_vec3(vec: Vec3) Box
Expands the dimensions of
box
to include the coordinates of the given vector.Added in version 1.2.
- Parameters:
vec – the coordinates of the point to include, as a
Vec3
- get_bounding_sphere() Sphere
Computes the bounding
Sphere
capable of containing the givenBox
.Added in version 1.2.
- get_max() Point3D
Retrieves the coordinates of the maximum point of the given
Box
.Added in version 1.2.
- get_min() Point3D
Retrieves the coordinates of the minimum point of the given
Box
.Added in version 1.2.
- get_size() Vec3
Retrieves the size of the box on all three axes, and stores it into the given
size
vector.Added in version 1.2.
- infinite() Box
A degenerate
Box
that cannot be expanded.The returned value is owned by Graphene and should not be modified or freed.
Added in version 1.2.
- init(min: Point3D | None = None, max: Point3D | None = None) Box
Initializes the given
Box
with two vertices.Added in version 1.2.
- Parameters:
min – the coordinates of the minimum vertex
max – the coordinates of the maximum vertex
- init_from_box(src: Box) Box
Initializes the given
Box
with the vertices of anotherBox
.Added in version 1.2.
- Parameters:
src – a
Box
- init_from_points(points: Sequence[Point3D]) Box
Initializes the given
Box
with the given array of vertices.If
n_points
is 0, the returned box is initialized withempty()
.Added in version 1.2.
- Parameters:
points – an array of
Point3D
- init_from_vec3(min: Vec3 | None = None, max: Vec3 | None = None) Box
Initializes the given
Box
with two vertices stored insideVec3
.Added in version 1.2.
- Parameters:
min – the coordinates of the minimum vertex
max – the coordinates of the maximum vertex
- init_from_vectors(vectors: Sequence[Vec3]) Box
Initializes the given
Box
with the given array of vertices.If
n_vectors
is 0, the returned box is initialized withempty()
.Added in version 1.2.
- Parameters:
vectors – an array of
Vec3
- intersection(b: Box) tuple[bool, Box]
Intersects the two given
Box
.If the two boxes do not intersect,
res
will contain a degenerate box initialized withempty()
.Added in version 1.2.
- Parameters:
b – a
Box
- minus_one() Box
A
Box
with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (0, 0, 0).The returned value is owned by Graphene and should not be modified or freed.
Added in version 1.2.
- one() Box
A
Box
with the minimum vertex set at (0, 0, 0) and the maximum vertex set at (1, 1, 1).The returned value is owned by Graphene and should not be modified or freed.
Added in version 1.2.
- one_minus_one() Box
A
Box
with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (1, 1, 1).The returned value is owned by Graphene and should not be modified or freed.
Added in version 1.2.