Open3D (C++ API)
0.16.1
|
A bounding box that is aligned along the coordinate axes and defined by the min_bound and max_bound. More...
#include <BoundingVolume.h>
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 |
AxisAlignedBoundingBox | Clone () const |
Returns copy of the AxisAlignedBoundingBox on the same device. More... | |
AxisAlignedBoundingBox & | Clear () 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 original tensor, it will be converted into the same data type. If the min bound makes the box invalid, it will not be set to the box. More... | |
void | SetMaxBound (const core::Tensor &max_bound) |
Set the max boundof the box. If the data type of the given tensor differs from the data type of the original tensor, it will be converted into the same data type. If the max bound makes the box invalid, it will not be set to the box. 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 |
AxisAlignedBoundingBox & | Translate (const core::Tensor &translation, bool relative=true) |
Translate the axis-aligned box by the given translation. More... | |
AxisAlignedBoundingBox & | Scale (double scale, const core::Tensor ¢er) |
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)\). More... | |
AxisAlignedBoundingBox & | operator+= (const AxisAlignedBoundingBox &other) |
Add operation for axis-aligned bounding box. The device of ohter 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 |
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 |
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... | |
![]() | |
virtual | ~Geometry () |
virtual Geometry & | Clear ()=0 |
Clear all elements in the geometry. More... | |
virtual bool | IsEmpty () const =0 |
Returns true iff the geometry is empty. More... | |
virtual core::Device | GetDevice () const =0 |
Returns the device of the geometry. More... | |
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) |
![]() | |
IsDevice ()=default | |
virtual | ~IsDevice ()=default |
virtual core::Device | GetDevice () const =0 |
bool | IsCPU () const |
bool | IsCUDA () const |
![]() | |
DrawableGeometry () | |
~DrawableGeometry () | |
bool | HasMaterial () const |
Check if a material has been applied to this Geometry with SetMaterial. More... | |
visualization::rendering::Material & | GetMaterial () |
Get material associated with this Geometry. More... | |
const visualization::rendering::Material & | GetMaterial () 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") |
core::Dtype | dtype_ = core::Float32 |
core::Tensor | min_bound_ |
core::Tensor | max_bound_ |
core::Tensor | color_ |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
Geometry (GeometryType type, int dimension) | |
Parameterized Constructor. More... | |
A bounding box that is aligned along the coordinate axes and defined by the min_bound and max_bound.
open3d::t::geometry::AxisAlignedBoundingBox::AxisAlignedBoundingBox | ( | const core::Device & | device = core::Device("CPU:0") | ) |
Construct an empty AxisAlignedBoundingBox on the provided device.
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.
min_bound | Lower bounds of the bounding box for all axes. Tensor of shape {3,}, and type float32 or float64. |
max_bound | Upper bounds of the bounding box for all axes. Tensor of shape {3,}, and type float32 or float64. |
|
inlineoverridevirtual |
|
overridevirtual |
Clear all elements in the geometry.
Implements open3d::t::geometry::Geometry.
|
inline |
Returns copy of the AxisAlignedBoundingBox on the same device.
|
static |
Creates the axis-aligned box that encloses the set of points.
points | A list of points with data type of float32 or float64 (N x 3 tensor, where N must be larger than 3). |
|
static |
Create an AxisAlignedBoundingBox from a legacy Open3D axis-aligned box.
dtype | The data type of the box for min_bound max_bound and color. The default is float32. |
device | The device of the box. The default is CPU:0. |
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 of float32.
|
inline |
|
inline |
|
inlineoverridevirtual |
Returns the device attribute of this AxisAlignedBoundingBox.
Implements open3d::t::geometry::Geometry.
|
inline |
Returns the data type attribute of this AxisAlignedBoundingBox.
|
inline |
Get the extent/length of the bounding box in x, y, and z dimension.
|
inline |
Returns the half extent of the bounding box.
|
inline |
|
inline |
Returns the maximum extent, i.e. the maximum of X, Y and Z axis' extents.
|
inline |
core::Tensor open3d::t::geometry::AxisAlignedBoundingBox::GetPointIndicesWithinBoundingBox | ( | const core::Tensor & | points | ) | const |
Indices to points that are within the bounding box.
points | Tensor with {N, 3} shape, and type float32 or float64. |
double open3d::t::geometry::AxisAlignedBoundingBox::GetXPercentage | ( | double | x | ) | const |
double open3d::t::geometry::AxisAlignedBoundingBox::GetYPercentage | ( | double | y | ) | const |
double open3d::t::geometry::AxisAlignedBoundingBox::GetZPercentage | ( | double | z | ) | const |
|
inlineoverridevirtual |
Returns true iff the geometry is empty.
Implements open3d::t::geometry::Geometry.
AxisAlignedBoundingBox & open3d::t::geometry::AxisAlignedBoundingBox::operator+= | ( | const AxisAlignedBoundingBox & | other | ) |
Add operation for axis-aligned bounding box. The device of ohter box must be the same as the device of the current box.
AxisAlignedBoundingBox & open3d::t::geometry::AxisAlignedBoundingBox::Scale | ( | double | scale, |
const core::Tensor & | center | ||
) |
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)\).
scale | The scale parameter. |
center | Center used for the scaling operation. Tensor of shape {3,}, type float32 or float64, device same as the box. |
void open3d::t::geometry::AxisAlignedBoundingBox::SetColor | ( | const core::Tensor & | color | ) |
Set the color of the box.
color | Tensor with {3,} shape, and type float32 or float64, with values in range [0.0, 1.0]. |
void open3d::t::geometry::AxisAlignedBoundingBox::SetMaxBound | ( | const core::Tensor & | max_bound | ) |
Set the max boundof the box. If the data type of the given tensor differs from the data type of the original tensor, it will be converted into the same data type. If the max bound makes the box invalid, it will not be set to the box.
min_bound | Tensor with {3,} shape, and type float32 or float64. |
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 original tensor, it will be converted into the same data type. If the min bound makes the box invalid, it will not be set to the box.
min_bound | Tensor with {3,} shape, and type float32 or float64. |
AxisAlignedBoundingBox open3d::t::geometry::AxisAlignedBoundingBox::To | ( | const core::Device & | device, |
bool | copy = false |
||
) | const |
Transfer the AxisAlignedBoundingBox to a specified device.
device | The targeted device to convert to. |
copy | If true, a new AxisAlignedBoundingBox is always created; if false, the copy is avoided when the original AxisAlignedBoundingBox is already on the targeted device. |
open3d::geometry::AxisAlignedBoundingBox open3d::t::geometry::AxisAlignedBoundingBox::ToLegacy | ( | ) | const |
Convert to a legacy Open3D axis-aligned box.
std::string open3d::t::geometry::AxisAlignedBoundingBox::ToString | ( | ) | const |
Text description.
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.
translation | Translation tensor of shape (3,), type float32 or float64, device same as the box. |
relative | Whether to perform relative translation. |
|
inline |
Returns the volume of the bounding box.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |