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#

class Box
classmethod alloc() Box#

Allocates a new Box.

The contents of the returned structure are undefined.

Added in version 1.2.

Methods#

class Box
contains_box(b: Box) bool#

Checks whether the Box a contains the given Box b.

Added in version 1.2.

Parameters:

b – a Box

contains_point(point: Point3D) bool#

Checks whether box contains the given point.

Added in version 1.2.

Parameters:

point – the coordinates to check

classmethod 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 at point.

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 given scalar value.

If scalar is positive, the Box will grow; if scalar is negative, the Box 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

free() None#

Frees the resources allocated by alloc().

Added in version 1.2.

get_bounding_sphere() Sphere#

Computes the bounding Sphere capable of containing the given Box.

Added in version 1.2.

get_center() Point3D#

Retrieves the coordinates of the center of a Box.

Added in version 1.2.

get_depth() float#

Retrieves the size of the box on the Z axis.

Added in version 1.2.

get_height() float#

Retrieves the size of the box on the Y axis.

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.

get_vertices() list[Vec3]#

Computes the vertices of the given Box.

Added in version 1.2.

get_width() float#

Retrieves the size of the box on the X axis.

Added in version 1.2.

classmethod 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 another Box.

Added in version 1.2.

Parameters:

src – a Box

init_from_points(points: list[Point3D]) Box#

Initializes the given Box with the given array of vertices.

If n_points is 0, the returned box is initialized with empty().

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 inside Vec3.

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 Box with the given array of vertices.

If n_vectors is 0, the returned box is initialized with empty().

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 with empty().

Added in version 1.2.

Parameters:

b – a Box

classmethod 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.

classmethod 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.

classmethod 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.

union(b: Box) Box#

Unions the two given Box.

Added in version 1.2.

Parameters:

b – the box to union to a

classmethod zero() Box#

A Box with both the minimum and maximum vertices set at (0, 0, 0).

The returned value is owned by Graphene and should not be modified or freed.

Added in version 1.2.

Fields#

class Box
max#
min#