Axis Aligned Bounding Box

class Utilities.aabb.AABB(*args, **kwargs)[source]
property area
classmethod build_from_points(points)[source]

Build the AABB using points. The constructed AABB will enclose the input set of points.

Parameters

points (torch.Tensor) – The (:math:’N’, dim) tensor of points.

property centers
property depth
property dim

The dimension of the AABB.

dim_prefix = ['x', 'y', 'z']

Class used to represent an Axis Aligned Bounding Box in 1D, 2D and 3D.

fill_count(counts, dtype=None, device=None)[source]

Fill the AABB uniformly with a set amount of points per dimension.

Returns

[:math:’N’, dim] shaped tensor with :math:’N’ the number of points inside the AABB.

Return type

torch.Tensor

fill_random(N, dtype=None, device=None)[source]

Fill the AABB with :math:’N’ Poisson distributed points.

Returns

[:math:’N’, dim] shaped tensor of the points inside the AABB.

Return type

torch.Tensor

fill_random_density(density, dtype=None, device=None)[source]

Fill the AABB with points following a :math:’lambda’=*density* Poisson law.

Returns

[:math:’N’, dim] shaped tensor with :math:’N’ the number of points inside the AABB.

Return type

torch.Tensor

fill_uniform_density(density, dtype=None, device=None)[source]

Fill the AABB uniformly. Used a density parameter with represent the number of points in a unit dim-cell of the AABB. :returns: [:math:’N’, dim] shaped tensor with :math:’N’ the number of points inside the AABB. :rtype: torch.Tensor

fill_uniform_spacing(spacing, dtype=None, device=None)[source]

Fill the AABB uniformly. Uses a spacing parameters which represent the length between each points on each axis.

Returns

[:math:’N’, dim] shaped tensor with :math:’N’ the number of points inside the AABB.

Return type

torch.Tensor

property height
is_inside(points)[source]
property kmax

dim-tuple of the upper boundaries.

property kmin

dim-tuple of the lower boundaries.

property length
scale(factor)[source]

TODO: Add documentation.

scale_(factor)[source]

TODO: Add documentation.

property shape

d-tuple (width, height, …).

squared()[source]

Returns an inplace squared AABB.

Returns

The squared AABB.

Return type

Utilities.AABB

squared_()[source]

Squares the AABB inplace (the center does not move).

tocouple()[source]

Returns the AABB as a dim-tuple of intervals.

Returns

dim-tuple of (kmin, kmax) couples.

Return type

tuple

todict()[source]

Returns the AABB as a dictionary.

Returns

The dictionary {‘xmin’: xmin, ‘xmax’: xmax, ‘ymin’: ymin, …}

Return type

dict

totuple()[source]

Returns the AABB as a 2*dim-tuple.

Returns

The d-tuple (xmin, xmax, ymin, ymax, …).

Return type

tuple

property volume
property width
property xmax
property xmin
property ymax
property ymin
property zmax
property zmin