Graphene.Box

Fields

Name

Type

Access

Description

max

Graphene.Vec3

r

min

Graphene.Vec3

r

Methods

class

alloc ()

class

empty ()

class

infinite ()

class

minus_one ()

class

one ()

class

one_minus_one ()

class

zero ()

contains_box (b)

contains_point (point)

equal (b)

expand (point)

expand_scalar (scalar)

expand_vec3 (vec)

free ()

get_bounding_sphere ()

get_center ()

get_depth ()

get_height ()

get_max ()

get_min ()

get_size ()

get_vertices ()

get_width ()

init (min, max)

init_from_box (src)

init_from_points (points)

init_from_vec3 (min, max)

init_from_vectors (vectors)

intersection (b)

union (b)

Details

class Graphene.Box

A 3D box, described as the volume between a minimum and a maximum vertices.

New in version 1.2.

classmethod alloc()
Returns:

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

Return type:

Graphene.Box

Allocates a new Graphene.Box.

The contents of the returned structure are undefined.

New in version 1.2.

classmethod empty()
Returns:

a Graphene.Box

Return type:

Graphene.Box

A degenerate Graphene.Box that can only be expanded.

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

New in version 1.2.

classmethod infinite()
Returns:

a Graphene.Box

Return type:

Graphene.Box

A degenerate Graphene.Box that cannot be expanded.

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

New in version 1.2.

classmethod minus_one()
Returns:

a Graphene.Box

Return type:

Graphene.Box

A Graphene.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.

New in version 1.2.

classmethod one()
Returns:

a Graphene.Box

Return type:

Graphene.Box

A Graphene.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.

New in version 1.2.

classmethod one_minus_one()
Returns:

a Graphene.Box

Return type:

Graphene.Box

A Graphene.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.

New in version 1.2.

classmethod zero()
Returns:

a Graphene.Box

Return type:

Graphene.Box

A Graphene.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.

New in version 1.2.

contains_box(b)
Parameters:

b (Graphene.Box) – a Graphene.Box

Returns:

true if the box is contained in the given box

Return type:

bool

Checks whether the Graphene.Box self contains the given Graphene.Box b.

New in version 1.2.

contains_point(point)
Parameters:

point (Graphene.Point3D) – the coordinates to check

Returns:

true if the point is contained in the given box

Return type:

bool

Checks whether self contains the given point.

New in version 1.2.

equal(b)
Parameters:

b (Graphene.Box) – a Graphene.Box

Returns:

true if the boxes are equal

Return type:

bool

Checks whether the two given boxes are equal.

New in version 1.2.

expand(point)
Parameters:

point (Graphene.Point3D) – the coordinates of the point to include

Returns:

return location for the expanded box

Return type:

res: Graphene.Box

Expands the dimensions of self to include the coordinates at point.

New in version 1.2.

expand_scalar(scalar)
Parameters:

scalar (float) – a scalar value

Returns:

return location for the expanded box

Return type:

res: Graphene.Box

Expands the dimensions of self by the given scalar value.

If scalar is positive, the Graphene.Box will grow; if scalar is negative, the Graphene.Box will shrink.

New in version 1.2.

expand_vec3(vec)
Parameters:

vec (Graphene.Vec3) – the coordinates of the point to include, as a Graphene.Vec3

Returns:

return location for the expanded box

Return type:

res: Graphene.Box

Expands the dimensions of self to include the coordinates of the given vector.

New in version 1.2.

free()

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

New in version 1.2.

get_bounding_sphere()
Returns:

return location for the bounding sphere

Return type:

sphere: Graphene.Sphere

Computes the bounding Graphene.Sphere capable of containing the given Graphene.Box.

New in version 1.2.

get_center()
Returns:

return location for the coordinates of the center

Return type:

center: Graphene.Point3D

Retrieves the coordinates of the center of a Graphene.Box.

New in version 1.2.

get_depth()
Returns:

the depth of the box

Return type:

float

Retrieves the size of the self on the Z axis.

New in version 1.2.

get_height()
Returns:

the height of the box

Return type:

float

Retrieves the size of the self on the Y axis.

New in version 1.2.

get_max()
Returns:

return location for the maximum point

Return type:

max: Graphene.Point3D

Retrieves the coordinates of the maximum point of the given Graphene.Box.

New in version 1.2.

get_min()
Returns:

return location for the minimum point

Return type:

min: Graphene.Point3D

Retrieves the coordinates of the minimum point of the given Graphene.Box.

New in version 1.2.

get_size()
Returns:

return location for the size

Return type:

size: Graphene.Vec3

Retrieves the size of the box on all three axes, and stores it into the given size vector.

New in version 1.2.

get_vertices()
Returns:

return location for an array of 8 Graphene.Vec3

Return type:

vertices: [Graphene.Vec3]

Computes the vertices of the given Graphene.Box.

New in version 1.2.

get_width()
Returns:

the width of the box

Return type:

float

Retrieves the size of the self on the X axis.

New in version 1.2.

init(min, max)
Parameters:
Returns:

the initialized Graphene.Box

Return type:

Graphene.Box

Initializes the given Graphene.Box with two vertices.

New in version 1.2.

init_from_box(src)
Parameters:

src (Graphene.Box) – a Graphene.Box

Returns:

the initialized Graphene.Box

Return type:

Graphene.Box

Initializes the given Graphene.Box with the vertices of another Graphene.Box.

New in version 1.2.

init_from_points(points)
Parameters:

points ([Graphene.Point3D]) – an array of Graphene.Point3D

Returns:

the initialized Graphene.Box

Return type:

Graphene.Box

Initializes the given Graphene.Box with the given array of vertices.

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

New in version 1.2.

init_from_vec3(min, max)
Parameters:
Returns:

the initialized Graphene.Box

Return type:

Graphene.Box

Initializes the given Graphene.Box with two vertices stored inside Graphene.Vec3.

New in version 1.2.

init_from_vectors(vectors)
Parameters:

vectors ([Graphene.Vec3]) – an array of Graphene.Vec3

Returns:

the initialized Graphene.Box

Return type:

Graphene.Box

Initializes the given Graphene.Box with the given array of vertices.

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

New in version 1.2.

intersection(b)
Parameters:

b (Graphene.Box) – a Graphene.Box

Returns:

true if the two boxes intersect

res:

return location for the result

Return type:

(bool, res: Graphene.Box)

Intersects the two given Graphene.Box.

If the two boxes do not intersect, res will contain a degenerate box initialized with Graphene.Box.empty().

New in version 1.2.

union(b)
Parameters:

b (Graphene.Box) – the box to union to self

Returns:

return location for the result

Return type:

res: Graphene.Box

Unions the two given Graphene.Box.

New in version 1.2.