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
Boxacontains the givenBoxb.Added in version 1.2.
- Parameters:
b – a
Box
- contains_point(point: Point3D) bool#
Checks whether
boxcontains the givenpoint.Added in version 1.2.
- Parameters:
point – the coordinates to check
- classmethod empty() Box#
A degenerate
Boxthat 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
boxto 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
boxby the givenscalarvalue.If
scalaris positive, theBoxwill grow; ifscalaris negative, theBoxwill shrink.Added in version 1.2.
- Parameters:
scalar – a scalar value
- expand_vec3(vec: Vec3) Box#
Expands the dimensions of
boxto 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
Spherecapable 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
sizevector.Added in version 1.2.
- classmethod infinite() Box#
A degenerate
Boxthat 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
Boxwith 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
Boxwith the vertices of anotherBox.Added in version 1.2.
- Parameters:
src – a
Box
- init_from_points(points: list[Point3D]) Box#
Initializes the given
Boxwith the given array of vertices.If
n_pointsis 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
Boxwith 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: list[Vec3]) Box#
Initializes the given
Boxwith the given array of vertices.If
n_vectorsis 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,
reswill contain a degenerate box initialized withempty().Added in version 1.2.
- Parameters:
b – a
Box
- classmethod minus_one() Box#
A
Boxwith 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.
- classmethod one() Box#
A
Boxwith 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.
- classmethod one_minus_one() Box#
A
Boxwith 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.