Open3D (C++ API)  0.18.0+252c867
Public Member Functions | Static Public Member Functions | Protected Attributes
open3d::t::geometry::AxisAlignedBoundingBox Class Reference

A bounding box that is aligned along the coordinate axes and defined by the min_bound and max_bound. More...

#include <BoundingVolume.h>

Inheritance diagram for open3d::t::geometry::AxisAlignedBoundingBox:
open3d::t::geometry::Geometry open3d::t::geometry::DrawableGeometry open3d::core::IsDevice

Public Member Functions

 AxisAlignedBoundingBox (const core::Device &device=core::Device("CPU:0"))
 Construct an empty AxisAlignedBoundingBox on the provided device. More...
 
 AxisAlignedBoundingBox (const core::Tensor &min_bound, const core::Tensor &max_bound)
 Construct an AxisAlignedBoundingBox from min/max bound. More...
 
virtual ~AxisAlignedBoundingBox () override
 
core::Device GetDevice () const override
 Returns the device attribute of this AxisAlignedBoundingBox. More...
 
core::Dtype GetDtype () const
 Returns the data type attribute of this AxisAlignedBoundingBox. More...
 
AxisAlignedBoundingBox To (const core::Device &device, bool copy=false) const
 Transfer the AxisAlignedBoundingBox to a specified device. More...
 
AxisAlignedBoundingBox Clone () const
 Returns copy of the AxisAlignedBoundingBox on the same device. More...
 
AxisAlignedBoundingBoxClear () override
 Clear all elements in the geometry. More...
 
bool IsEmpty () const override
 Returns true iff the geometry is empty. More...
 
void SetMinBound (const core::Tensor &min_bound)
 Set the min bound of the box. If the data type of the given tensor differs from the data type of the box, an exception will be thrown. More...
 
void SetMaxBound (const core::Tensor &max_bound)
 Set the max bound of the box. If the data type of the given tensor differs from the data type of the box, an exception will be thrown. More...
 
void SetColor (const core::Tensor &color)
 Set the color of the box. If the data type of the given tensor differs from the data type of the box, an exception will be thrown. More...
 
core::Tensor GetMinBound () const
 
core::Tensor GetMaxBound () const
 
core::Tensor GetColor () const
 
core::Tensor GetCenter () const
 
AxisAlignedBoundingBoxTranslate (const core::Tensor &translation, bool relative=true)
 Translate the axis-aligned box by the given translation. More...
 
AxisAlignedBoundingBoxScale (double scale, const utility::optional< core::Tensor > &center=utility::nullopt)
 Scale the axis-aligned box. If \(mi\) is the min_bound and \(ma\) is the max_bound of the axis aligned bounding box, and \(s\) and \(c\) are the provided scaling factor and center respectively, then the new min_bound and max_bound are given by \(mi = c + s (mi - c)\) and \(ma = c + s (ma - c)\). The scaling center will be the box center if it is not specified. More...
 
AxisAlignedBoundingBoxoperator+= (const AxisAlignedBoundingBox &other)
 Add operation for axis-aligned bounding box. The device of other box must be the same as the device of the current box. More...
 
core::Tensor GetExtent () const
 Get the extent/length of the bounding box in x, y, and z dimension. More...
 
core::Tensor GetHalfExtent () const
 Returns the half extent of the bounding box. More...
 
double GetMaxExtent () const
 Returns the maximum extent, i.e. the maximum of X, Y and Z axis' extents. More...
 
double GetXPercentage (double x) const
 
double GetYPercentage (double y) const
 
double GetZPercentage (double z) const
 
double Volume () const
 Returns the volume of the bounding box. More...
 
core::Tensor GetBoxPoints () const
 Returns the eight points that define the bounding box. More...
 
core::Tensor GetPointIndicesWithinBoundingBox (const core::Tensor &points) const
 Indices to points that are within the bounding box. More...
 
std::string ToString () const
 Text description. More...
 
open3d::geometry::AxisAlignedBoundingBox ToLegacy () const
 Convert to a legacy Open3D axis-aligned box. More...
 
OrientedBoundingBox GetOrientedBoundingBox () const
 Convert to an oriented box. More...
 
- Public Member Functions inherited from open3d::t::geometry::Geometry
virtual ~Geometry ()
 
GeometryType GetGeometryType () const
 Returns one of registered geometry types. More...
 
int Dimension () const
 Returns whether the geometry is 2D or 3D. More...
 
std::string GetName () const
 
void SetName (const std::string &name)
 
- Public Member Functions inherited from open3d::core::IsDevice
 IsDevice ()=default
 
virtual ~IsDevice ()=default
 
bool IsCPU () const
 
bool IsCUDA () const
 
- Public Member Functions inherited from open3d::t::geometry::DrawableGeometry
 DrawableGeometry ()
 
 ~DrawableGeometry ()
 
bool HasMaterial () const
 Check if a material has been applied to this Geometry with SetMaterial. More...
 
visualization::rendering::MaterialGetMaterial ()
 Get material associated with this Geometry. More...
 
const visualization::rendering::MaterialGetMaterial () const
 Get const reference to material associated with this Geometry. More...
 
void SetMaterial (const visualization::rendering::Material &material)
 Set the material properties associate with this Geometry. More...
 

Static Public Member Functions

static AxisAlignedBoundingBox FromLegacy (const open3d::geometry::AxisAlignedBoundingBox &box, const core::Dtype &dtype=core::Float32, const core::Device &device=core::Device("CPU:0"))
 
static AxisAlignedBoundingBox CreateFromPoints (const core::Tensor &points)
 

Protected Attributes

core::Device device_ = core::Device("CPU:0")
 The device to use for the bounding box. The default is CPU:0. More...
 
core::Dtype dtype_ = core::Float32
 The data type of the bounding box. More...
 
core::Tensor min_bound_
 The lower x, y, z bounds of the bounding box. More...
 
core::Tensor max_bound_
 The upper x, y, z bounds of the bounding box. More...
 
core::Tensor color_
 The color of the bounding box in RGB. The default is white. More...
 

Additional Inherited Members

- Public Types inherited from open3d::t::geometry::Geometry
enum class  GeometryType {
  Unspecified = 0 , PointCloud = 1 , VoxelGrid = 2 , Octree = 3 ,
  LineSet = 4 , MeshBase = 5 , TriangleMesh = 6 , HalfEdgeTriangleMesh = 7 ,
  Image = 8 , RGBDImage = 9 , TetraMesh = 10 , OrientedBoundingBox = 11 ,
  AxisAlignedBoundingBox = 12
}
 Specifies possible geometry types. More...
 
- Protected Member Functions inherited from open3d::t::geometry::Geometry
 Geometry (GeometryType type, int dimension)
 Parameterized Constructor. More...
 

Detailed Description

A bounding box that is aligned along the coordinate axes and defined by the min_bound and max_bound.

Constructor & Destructor Documentation

◆ AxisAlignedBoundingBox() [1/2]

open3d::t::geometry::AxisAlignedBoundingBox::AxisAlignedBoundingBox ( const core::Device device = core::Device("CPU:0"))

Construct an empty AxisAlignedBoundingBox on the provided device.

◆ AxisAlignedBoundingBox() [2/2]

open3d::t::geometry::AxisAlignedBoundingBox::AxisAlignedBoundingBox ( const core::Tensor min_bound,
const core::Tensor max_bound 
)

Construct an AxisAlignedBoundingBox from min/max bound.

The AxisAlignedBoundingBox will be created on the device of the given bound tensor, which must be on the same device and have the same data type.

Parameters
min_boundLower bounds of the bounding box for all axes. Tensor of shape {3,}, and type float32 or float64.
max_boundUpper bounds of the bounding box for all axes. Tensor of shape {3,}, and type float32 or float64.

◆ ~AxisAlignedBoundingBox()

virtual open3d::t::geometry::AxisAlignedBoundingBox::~AxisAlignedBoundingBox ( )
inlineoverridevirtual

Member Function Documentation

◆ Clear()

AxisAlignedBoundingBox & open3d::t::geometry::AxisAlignedBoundingBox::Clear ( )
overridevirtual

Clear all elements in the geometry.

Implements open3d::t::geometry::Geometry.

◆ Clone()

AxisAlignedBoundingBox open3d::t::geometry::AxisAlignedBoundingBox::Clone ( ) const
inline

Returns copy of the AxisAlignedBoundingBox on the same device.

◆ CreateFromPoints()

AxisAlignedBoundingBox open3d::t::geometry::AxisAlignedBoundingBox::CreateFromPoints ( const core::Tensor points)
static

Creates the axis-aligned box that encloses the set of points.

Parameters
pointsA list of points with data type of float32 or float64 (N x 3 tensor).
Returns
AxisAlignedBoundingBox with same data type and device as input points.

◆ FromLegacy()

AxisAlignedBoundingBox open3d::t::geometry::AxisAlignedBoundingBox::FromLegacy ( const open3d::geometry::AxisAlignedBoundingBox box,
const core::Dtype dtype = core::Float32,
const core::Device device = core::Device("CPU:0") 
)
static

Create an AxisAlignedBoundingBox from a legacy Open3D axis-aligned box.

Parameters
boxLegacy AxisAlignedBoundingBox.
dtypeThe data type of the box for min_bound, max_bound and color. The default is float32.
deviceThe device of the box. The default is CPU:0.

◆ GetBoxPoints()

core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::GetBoxPoints ( ) const

Returns the eight points that define the bounding box.

The Return tensor has shape {8, 3} and data type same as the box.

◆ GetCenter()

core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::GetCenter ( ) const
inline

◆ GetColor()

core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::GetColor ( ) const
inline

◆ GetDevice()

core::Device open3d::t::geometry::AxisAlignedBoundingBox::GetDevice ( ) const
inlineoverridevirtual

Returns the device attribute of this AxisAlignedBoundingBox.

Implements open3d::t::geometry::Geometry.

◆ GetDtype()

core::Dtype open3d::t::geometry::AxisAlignedBoundingBox::GetDtype ( ) const
inline

Returns the data type attribute of this AxisAlignedBoundingBox.

◆ GetExtent()

core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::GetExtent ( ) const
inline

Get the extent/length of the bounding box in x, y, and z dimension.

◆ GetHalfExtent()

core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::GetHalfExtent ( ) const
inline

Returns the half extent of the bounding box.

◆ GetMaxBound()

core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::GetMaxBound ( ) const
inline

◆ GetMaxExtent()

double open3d::t::geometry::AxisAlignedBoundingBox::GetMaxExtent ( ) const
inline

Returns the maximum extent, i.e. the maximum of X, Y and Z axis' extents.

◆ GetMinBound()

core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::GetMinBound ( ) const
inline

◆ GetOrientedBoundingBox()

OrientedBoundingBox open3d::t::geometry::AxisAlignedBoundingBox::GetOrientedBoundingBox ( ) const

Convert to an oriented box.

◆ GetPointIndicesWithinBoundingBox()

core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::GetPointIndicesWithinBoundingBox ( const core::Tensor points) const

Indices to points that are within the bounding box.

Parameters
pointsTensor with {N, 3} shape, and type float32 or float64.

◆ GetXPercentage()

double open3d::t::geometry::AxisAlignedBoundingBox::GetXPercentage ( double  x) const

Calculates the percentage position of the given x-coordinate within the x-axis range of this AxisAlignedBoundingBox.

◆ GetYPercentage()

double open3d::t::geometry::AxisAlignedBoundingBox::GetYPercentage ( double  y) const

Calculates the percentage position of the given y-coordinate within the y-axis range of this AxisAlignedBoundingBox.

◆ GetZPercentage()

double open3d::t::geometry::AxisAlignedBoundingBox::GetZPercentage ( double  z) const

Calculates the percentage position of the given z-coordinate within the z-axis range of this AxisAlignedBoundingBox.

◆ IsEmpty()

bool open3d::t::geometry::AxisAlignedBoundingBox::IsEmpty ( ) const
inlineoverridevirtual

Returns true iff the geometry is empty.

Implements open3d::t::geometry::Geometry.

◆ operator+=()

AxisAlignedBoundingBox & open3d::t::geometry::AxisAlignedBoundingBox::operator+= ( const AxisAlignedBoundingBox other)

Add operation for axis-aligned bounding box. The device of other box must be the same as the device of the current box.

◆ Scale()

AxisAlignedBoundingBox & open3d::t::geometry::AxisAlignedBoundingBox::Scale ( double  scale,
const utility::optional< core::Tensor > &  center = utility::nullopt 
)

Scale the axis-aligned box. If \(mi\) is the min_bound and \(ma\) is the max_bound of the axis aligned bounding box, and \(s\) and \(c\) are the provided scaling factor and center respectively, then the new min_bound and max_bound are given by \(mi = c + s (mi - c)\) and \(ma = c + s (ma - c)\). The scaling center will be the box center if it is not specified.

Parameters
scaleThe scale parameter.
centerCenter used for the scaling operation. Tensor of shape {3,}, type float32 or float64, device same as the box.

◆ SetColor()

void open3d::t::geometry::AxisAlignedBoundingBox::SetColor ( const core::Tensor color)

Set the color of the box. If the data type of the given tensor differs from the data type of the box, an exception will be thrown.

Parameters
colorTensor with {3,} shape, and type float32 or float64, with values in range [0.0, 1.0].

◆ SetMaxBound()

void open3d::t::geometry::AxisAlignedBoundingBox::SetMaxBound ( const core::Tensor max_bound)

Set the max bound of the box. If the data type of the given tensor differs from the data type of the box, an exception will be thrown.

If the max bound makes the box invalid, it will not be set to the box.

Parameters
max_boundTensor with {3,} shape, and type float32 or float64.

◆ SetMinBound()

void open3d::t::geometry::AxisAlignedBoundingBox::SetMinBound ( const core::Tensor min_bound)

Set the min bound of the box. If the data type of the given tensor differs from the data type of the box, an exception will be thrown.

If the min bound makes the box invalid, it will not be set to the box.

Parameters
min_boundTensor with {3,} shape, and type float32 or float64.

◆ To()

AxisAlignedBoundingBox open3d::t::geometry::AxisAlignedBoundingBox::To ( const core::Device device,
bool  copy = false 
) const

Transfer the AxisAlignedBoundingBox to a specified device.

Parameters
deviceThe targeted device to convert to.
copyIf true, a new AxisAlignedBoundingBox is always created; If false, the copy is avoided when the original AxisAlignedBoundingBox is already on the targeted device.

◆ ToLegacy()

open3d::geometry::AxisAlignedBoundingBox open3d::t::geometry::AxisAlignedBoundingBox::ToLegacy ( ) const

Convert to a legacy Open3D axis-aligned box.

◆ ToString()

std::string open3d::t::geometry::AxisAlignedBoundingBox::ToString ( ) const

Text description.

◆ Translate()

AxisAlignedBoundingBox & open3d::t::geometry::AxisAlignedBoundingBox::Translate ( const core::Tensor translation,
bool  relative = true 
)

Translate the axis-aligned box by the given translation.

If relative is true, the translation is applied to the current min and max bound. If relative is false, the translation is applied to make the box's center at the given translation.

Parameters
translationTranslation tensor of shape (3,), type float32 or float64, device same as the box.
relativeWhether to perform relative translation.

◆ Volume()

double open3d::t::geometry::AxisAlignedBoundingBox::Volume ( ) const
inline

Returns the volume of the bounding box.

Field Documentation

◆ color_

core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::color_
protected

The color of the bounding box in RGB. The default is white.

◆ device_

core::Device open3d::t::geometry::AxisAlignedBoundingBox::device_ = core::Device("CPU:0")
protected

The device to use for the bounding box. The default is CPU:0.

◆ dtype_

core::Dtype open3d::t::geometry::AxisAlignedBoundingBox::dtype_ = core::Float32
protected

The data type of the bounding box.

◆ max_bound_

core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::max_bound_
protected

The upper x, y, z bounds of the bounding box.

◆ min_bound_

core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::min_bound_
protected

The lower x, y, z bounds of the bounding box.


The documentation for this class was generated from the following files: