Open3D (C++ API)
0.18.0+252c867
|
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 |
Transfer the AxisAlignedBoundingBox to a specified device. More... | |
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 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 |
AxisAlignedBoundingBox & | Translate (const core::Tensor &translation, bool relative=true) |
Translate the axis-aligned box by the given translation. More... | |
AxisAlignedBoundingBox & | Scale (double scale, const utility::optional< core::Tensor > ¢er=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... | |
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. 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::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") |
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... | |
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). |
|
static |
Create an AxisAlignedBoundingBox from a legacy Open3D axis-aligned box.
box | Legacy AxisAlignedBoundingBox. |
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 same as the box.
|
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 |
OrientedBoundingBox open3d::t::geometry::AxisAlignedBoundingBox::GetOrientedBoundingBox | ( | ) | const |
Convert to an oriented box.
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 |
Calculates the percentage position of the given x-coordinate within the x-axis range of this AxisAlignedBoundingBox.
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.
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.
|
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 other box must be the same as the device of the current box.
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.
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. If the data type of the given tensor differs from the data type of the box, an exception will be thrown.
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 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.
max_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 box, an exception will be thrown.
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 |
The color of the bounding box in RGB. The default is white.
|
protected |
The device to use for the bounding box. The default is CPU:0.
|
protected |
The data type of the bounding box.
|
protected |
The upper x, y, z bounds of the bounding box.
|
protected |
The lower x, y, z bounds of the bounding box.