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

A bounding box oriented along an arbitrary frame of reference. More...

#include <BoundingVolume.h>

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

Public Member Functions

 OrientedBoundingBox (const core::Device &device=core::Device("CPU:0"))
 Construct an empty OrientedBoundingBox on the provided device. More...
 
 OrientedBoundingBox (const core::Tensor &center, const core::Tensor &rotation, const core::Tensor &extent)
 Construct an OrientedBoundingBox from center, rotation and extent. More...
 
virtual ~OrientedBoundingBox () override
 
core::Device GetDevice () const override
 Returns the device attribute of this OrientedBoundingBox. More...
 
core::Dtype GetDtype () const
 Returns the data type attribute of this OrientedBoundingBox. More...
 
OrientedBoundingBox To (const core::Device &device, bool copy=false) const
 
OrientedBoundingBox Clone () const
 Returns copy of the OrientedBoundingBox on the same device. More...
 
OrientedBoundingBoxClear () override
 Clear all elements in the geometry. More...
 
bool IsEmpty () const override
 Returns true iff the geometry is empty. More...
 
void SetCenter (const core::Tensor &center)
 Set the center 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 SetRotation (const core::Tensor &rotation)
 Set the rotation matrix 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 SetExtent (const core::Tensor &extent)
 Set the extent 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. More...
 
core::Tensor GetMinBound () const
 
core::Tensor GetMaxBound () const
 
core::Tensor GetColor () const
 
core::Tensor GetCenter () const
 
core::Tensor GetRotation () const
 
core::Tensor GetExtent () const
 
OrientedBoundingBoxTranslate (const core::Tensor &translation, bool relative=true)
 Translate the oriented box by the given translation. If relative is true, the translation is added to the center of the box. If false, the center will be assigned to the translation. More...
 
OrientedBoundingBoxRotate (const core::Tensor &rotation, const utility::optional< core::Tensor > &center=utility::nullopt)
 Rotate the oriented box by the given rotation matrix. If the rotation matrix is not orthogonal, the rotation will no be applied. The rotation center will be the box center if it is not specified. More...
 
OrientedBoundingBoxTransform (const core::Tensor &transformation)
 Transform the oriented box by the given transformation matrix. More...
 
OrientedBoundingBoxScale (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...
 
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::OrientedBoundingBox ToLegacy () const
 Convert to a legacy Open3D oriented box. More...
 
AxisAlignedBoundingBox GetAxisAlignedBoundingBox () const
 Convert to an axis-aligned 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 OrientedBoundingBox CreateFromAxisAlignedBoundingBox (const AxisAlignedBoundingBox &aabb)
 
static OrientedBoundingBox FromLegacy (const open3d::geometry::OrientedBoundingBox &box, const core::Dtype &dtype=core::Float32, const core::Device &device=core::Device("CPU:0"))
 
static OrientedBoundingBox CreateFromPoints (const core::Tensor &points, bool robust=false)
 

Protected Attributes

core::Device device_ = core::Device("CPU:0")
 
core::Dtype dtype_ = core::Float32
 
core::Tensor center_
 
core::Tensor rotation_
 
core::Tensor extent_
 
core::Tensor color_
 

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 oriented along an arbitrary frame of reference.

Constructor & Destructor Documentation

◆ OrientedBoundingBox() [1/2]

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

Construct an empty OrientedBoundingBox on the provided device.

◆ OrientedBoundingBox() [2/2]

open3d::t::geometry::OrientedBoundingBox::OrientedBoundingBox ( const core::Tensor center,
const core::Tensor rotation,
const core::Tensor extent 
)

Construct an OrientedBoundingBox from center, rotation and extent.

The OrientedBoundingBox will be created on the device of the given tensors, which must be on the same device and have the same data type.

Parameters
centerCenter of the bounding box. Tensor of shape {3,}, and type float32 or float64.
rotationRotation matrix of the bounding box. Tensor of shape {3, 3}, and type float32 or float64.
extentExtent of the bounding box. Tensor of shape {3,}, and type float32 or float64.

◆ ~OrientedBoundingBox()

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

Member Function Documentation

◆ Clear()

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

Clear all elements in the geometry.

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

◆ Clone()

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

Returns copy of the OrientedBoundingBox on the same device.

◆ CreateFromAxisAlignedBoundingBox()

OrientedBoundingBox open3d::t::geometry::OrientedBoundingBox::CreateFromAxisAlignedBoundingBox ( const AxisAlignedBoundingBox aabb)
static

Create an oriented bounding box from the AxisAlignedBoundingBox.

Parameters
aabbAxisAlignedBoundingBox object from which OrientedBoundingBox is created.
Returns
OrientedBoundingBox with the same device and dtype as input box.

◆ CreateFromPoints()

OrientedBoundingBox open3d::t::geometry::OrientedBoundingBox::CreateFromPoints ( const core::Tensor points,
bool  robust = false 
)
static

Creates an oriented bounding box using a PCA. Note that this is only an approximation to the minimum oriented bounding box that could be computed for example with O'Rourke's algorithm (cf. http://cs.smith.edu/~jorourke/Papers/MinVolBox.pdf, https://www.geometrictools.com/Documentation/MinimumVolumeBox.pdf) This is a wrapper for a CPU implementation.

Parameters
pointsA list of points with data type of float32 or float64 (N x 3 tensor, where N must be larger than 3).
robustIf set to true uses a more robust method which works in degenerate cases but introduces noise to the points coordinates.
Returns
OrientedBoundingBox with same data type and device as input points.

◆ FromLegacy()

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

Create an OrientedBoundingBox from a legacy Open3D oriented box.

Parameters
boxLegacy OrientedBoundingBox.
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.

◆ GetAxisAlignedBoundingBox()

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

Convert to an axis-aligned box.

◆ GetBoxPoints()

core::Tensor open3d::t::geometry::OrientedBoundingBox::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.

///      ------- x
///     /|
///    / |
///   /  | z
///  y
///      0 ------------------- 1
///       /|                /|
///      / |               / |
///     /  |              /  |
///    /   |             /   |
/// 2 ------------------- 7  |
///   |    |____________|____| 6
///   |   /3            |   /
///   |  /              |  /
///   | /               | /
///   |/                |/
/// 5 ------------------- 4
/// 

◆ GetCenter()

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

◆ GetColor()

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

◆ GetDevice()

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

Returns the device attribute of this OrientedBoundingBox.

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

◆ GetDtype()

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

Returns the data type attribute of this OrientedBoundingBox.

◆ GetExtent()

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

◆ GetMaxBound()

core::Tensor open3d::t::geometry::OrientedBoundingBox::GetMaxBound ( ) const

◆ GetMinBound()

core::Tensor open3d::t::geometry::OrientedBoundingBox::GetMinBound ( ) const

◆ GetPointIndicesWithinBoundingBox()

core::Tensor open3d::t::geometry::OrientedBoundingBox::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.

◆ GetRotation()

core::Tensor open3d::t::geometry::OrientedBoundingBox::GetRotation ( ) const
inline

◆ IsEmpty()

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

Returns true iff the geometry is empty.

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

◆ Rotate()

OrientedBoundingBox & open3d::t::geometry::OrientedBoundingBox::Rotate ( const core::Tensor rotation,
const utility::optional< core::Tensor > &  center = utility::nullopt 
)

Rotate the oriented box by the given rotation matrix. If the rotation matrix is not orthogonal, the rotation will no be applied. The rotation center will be the box center if it is not specified.

Parameters
rotationRotation matrix of shape {3, 3}, type float32 or float64, device same as the box.
centerCenter of the rotation, default is null, which means use center of the box as rotation center.

◆ Scale()

OrientedBoundingBox & open3d::t::geometry::OrientedBoundingBox::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.

◆ SetCenter()

void open3d::t::geometry::OrientedBoundingBox::SetCenter ( const core::Tensor center)

Set the center 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
centerTensor with {3,} shape, and type float32 or float64.

◆ SetColor()

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

Set the color of the box.

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

◆ SetExtent()

void open3d::t::geometry::OrientedBoundingBox::SetExtent ( const core::Tensor extent)

Set the extent 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
extentTensor with {3,} shape, and type float32 or float64.

◆ SetRotation()

void open3d::t::geometry::OrientedBoundingBox::SetRotation ( const core::Tensor rotation)

Set the rotation matrix 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
rotationTensor with {3, 3} shape, and type float32 or float64.

◆ To()

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

Transfer the OrientedBoundingBox to a specified device.

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

◆ ToLegacy()

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

Convert to a legacy Open3D oriented box.

◆ ToString()

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

Text description.

◆ Transform()

OrientedBoundingBox & open3d::t::geometry::OrientedBoundingBox::Transform ( const core::Tensor transformation)

Transform the oriented box by the given transformation matrix.

Parameters
transformationTransformation matrix of shape {4, 4}, type float32 or float64, device same as the box.

◆ Translate()

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

Translate the oriented box by the given translation. If relative is true, the translation is added to the center of the box. If false, the center will be assigned to the 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::OrientedBoundingBox::Volume ( ) const
inline

Returns the volume of the bounding box.

Field Documentation

◆ center_

core::Tensor open3d::t::geometry::OrientedBoundingBox::center_
protected

◆ color_

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

◆ device_

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

◆ dtype_

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

◆ extent_

core::Tensor open3d::t::geometry::OrientedBoundingBox::extent_
protected

◆ rotation_

core::Tensor open3d::t::geometry::OrientedBoundingBox::rotation_
protected

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