Open3D (C++ API)
0.18.0+252c867
|
A bounding box oriented along an arbitrary frame of reference. More...
#include <BoundingVolume.h>
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 ¢er, 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... | |
OrientedBoundingBox & | Clear () 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 ¢er) |
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 |
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. More... | |
OrientedBoundingBox & | Rotate (const core::Tensor &rotation, const utility::optional< core::Tensor > ¢er=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... | |
OrientedBoundingBox & | Transform (const core::Tensor &transformation) |
Transform the oriented box by the given transformation matrix. More... | |
OrientedBoundingBox & | 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... | |
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::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 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... | |
A bounding box oriented along an arbitrary frame of reference.
open3d::t::geometry::OrientedBoundingBox::OrientedBoundingBox | ( | const core::Device & | device = core::Device("CPU:0") | ) |
Construct an empty OrientedBoundingBox on the provided device.
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.
center | Center of the bounding box. Tensor of shape {3,}, and type float32 or float64. |
rotation | Rotation matrix of the bounding box. Tensor of shape {3, 3}, and type float32 or float64. |
extent | Extent of the bounding box. 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 OrientedBoundingBox on the same device.
|
static |
Create an oriented bounding box from the AxisAlignedBoundingBox.
aabb | AxisAlignedBoundingBox object from which OrientedBoundingBox is created. |
|
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.
points | A list of points with data type of float32 or float64 (N x 3 tensor, where N must be larger than 3). |
robust | If set to true uses a more robust method which works in degenerate cases but introduces noise to the points coordinates. |
|
static |
Create an OrientedBoundingBox from a legacy Open3D oriented box.
box | Legacy OrientedBoundingBox. |
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. |
AxisAlignedBoundingBox open3d::t::geometry::OrientedBoundingBox::GetAxisAlignedBoundingBox | ( | ) | const |
Convert to an axis-aligned box.
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 ///
|
inline |
|
inline |
|
inlineoverridevirtual |
Returns the device attribute of this OrientedBoundingBox.
Implements open3d::t::geometry::Geometry.
|
inline |
Returns the data type attribute of this OrientedBoundingBox.
|
inline |
core::Tensor open3d::t::geometry::OrientedBoundingBox::GetMaxBound | ( | ) | const |
core::Tensor open3d::t::geometry::OrientedBoundingBox::GetMinBound | ( | ) | const |
core::Tensor open3d::t::geometry::OrientedBoundingBox::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. |
|
inline |
|
inlineoverridevirtual |
Returns true iff the geometry is empty.
Implements open3d::t::geometry::Geometry.
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.
rotation | Rotation matrix of shape {3, 3}, type float32 or float64, device same as the box. |
center | Center of the rotation, default is null, which means use center of the box as rotation center. |
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.
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::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.
center | Tensor with {3,} shape, and type float32 or float64. |
void open3d::t::geometry::OrientedBoundingBox::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::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.
extent | Tensor with {3,} shape, and type float32 or float64. |
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.
rotation | Tensor with {3, 3} shape, and type float32 or float64. |
OrientedBoundingBox open3d::t::geometry::OrientedBoundingBox::To | ( | const core::Device & | device, |
bool | copy = false |
||
) | const |
Transfer the OrientedBoundingBox to a specified device.
device | The targeted device to convert to. |
copy | If true, a new OrientedBoundingBox is always created; if false, the copy is avoided when the original OrientedBoundingBox is already on the targeted device. |
open3d::geometry::OrientedBoundingBox open3d::t::geometry::OrientedBoundingBox::ToLegacy | ( | ) | const |
Convert to a legacy Open3D oriented box.
std::string open3d::t::geometry::OrientedBoundingBox::ToString | ( | ) | const |
Text description.
OrientedBoundingBox & open3d::t::geometry::OrientedBoundingBox::Transform | ( | const core::Tensor & | transformation | ) |
Transform the oriented box by the given transformation matrix.
transformation | Transformation matrix of shape {4, 4}, type float32 or float64, device same as the box. |
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.
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 |
|
protected |