Open3D (C++ API)
Public Member Functions | Static Public Member Functions | Data Fields
open3d::geometry::OrientedBoundingBox Class Reference

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

#include <BoundingVolume.h>

Inheritance diagram for open3d::geometry::OrientedBoundingBox:
open3d::geometry::Geometry3D open3d::geometry::Geometry

Public Member Functions

 OrientedBoundingBox ()
 Default constructor. More...
 
 OrientedBoundingBox (const Eigen::Vector3d &center, const Eigen::Matrix3d &R, const Eigen::Vector3d &extent)
 Parameterized constructor. More...
 
 ~OrientedBoundingBox () override
 
OrientedBoundingBoxClear () override
 Clear all elements in the geometry. More...
 
bool IsEmpty () const override
 Returns true iff the geometry is empty. More...
 
virtual Eigen::Vector3d GetMinBound () const override
 Returns min bounds for geometry coordinates. More...
 
virtual Eigen::Vector3d GetMaxBound () const override
 Returns max bounds for geometry coordinates. More...
 
virtual Eigen::Vector3d GetCenter () const override
 Returns the center of the geometry coordinates. More...
 
virtual AxisAlignedBoundingBox GetAxisAlignedBoundingBox () const override
 Returns an axis-aligned bounding box of the geometry. More...
 
virtual OrientedBoundingBox GetOrientedBoundingBox () const override
 Returns an oriented bounding box of the geometry. More...
 
virtual OrientedBoundingBoxTransform (const Eigen::Matrix4d &transformation) override
 Apply transformation (4x4 matrix) to the geometry coordinates. More...
 
virtual OrientedBoundingBoxTranslate (const Eigen::Vector3d &translation, bool relative=true) override
 Apply translation to the geometry coordinates. More...
 
virtual OrientedBoundingBoxScale (const double scale, const Eigen::Vector3d &center) override
 Scales the oriented bounding boxs. The extent parameter is multiplied by the scale factor and the center is set to the given parameter.. More...
 
virtual OrientedBoundingBoxRotate (const Eigen::Matrix3d &R, const Eigen::Vector3d &center) override
 Rotates the oriented bounding boxs. Sets the rotation and center of the oriented bounding box to the given parameters. More...
 
double Volume () const
 Returns the volume of the bounding box. More...
 
std::vector< Eigen::Vector3d > GetBoxPoints () const
 
std::vector< size_t > GetPointIndicesWithinBoundingBox (const std::vector< Eigen::Vector3d > &points) const
 Return indices to points that are within the bounding box. More...
 
- Public Member Functions inherited from open3d::geometry::Geometry3D
 ~Geometry3D () override
 
- Public Member Functions inherited from open3d::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)
 

Static Public Member Functions

static OrientedBoundingBox CreateFromAxisAlignedBoundingBox (const AxisAlignedBoundingBox &aabox)
 
static OrientedBoundingBox CreateFromPoints (const std::vector< Eigen::Vector3d > &points)
 
- Static Public Member Functions inherited from open3d::geometry::Geometry3D
static Eigen::Matrix3d GetRotationMatrixFromXYZ (const Eigen::Vector3d &rotation)
 Get Rotation Matrix from XYZ RotationType. More...
 
static Eigen::Matrix3d GetRotationMatrixFromYZX (const Eigen::Vector3d &rotation)
 Get Rotation Matrix from YZX RotationType. More...
 
static Eigen::Matrix3d GetRotationMatrixFromZXY (const Eigen::Vector3d &rotation)
 Get Rotation Matrix from ZXY RotationType. More...
 
static Eigen::Matrix3d GetRotationMatrixFromXZY (const Eigen::Vector3d &rotation)
 Get Rotation Matrix from XZY RotationType. More...
 
static Eigen::Matrix3d GetRotationMatrixFromZYX (const Eigen::Vector3d &rotation)
 Get Rotation Matrix from ZYX RotationType. More...
 
static Eigen::Matrix3d GetRotationMatrixFromYXZ (const Eigen::Vector3d &rotation)
 Get Rotation Matrix from YXZ RotationType. More...
 
static Eigen::Matrix3d GetRotationMatrixFromAxisAngle (const Eigen::Vector3d &rotation)
 Get Rotation Matrix from AxisAngle RotationType. More...
 
static Eigen::Matrix3d GetRotationMatrixFromQuaternion (const Eigen::Vector4d &rotation)
 Get Rotation Matrix from Quaternion. More...
 

Data Fields

Eigen::Vector3d center_
 The center point of the bounding box. More...
 
Eigen::Matrix3d R_
 
Eigen::Vector3d extent_
 The extent of the bounding box in its frame of reference. More...
 
Eigen::Vector3d color_
 The color of the bounding box in RGB. More...
 

Additional Inherited Members

- Public Types inherited from open3d::geometry::Geometry
enum  GeometryType {
  GeometryType::Unspecified = 0, GeometryType::PointCloud = 1, GeometryType::VoxelGrid = 2, GeometryType::Octree = 3,
  GeometryType::LineSet = 4, GeometryType::MeshBase = 5, GeometryType::TriangleMesh = 6, GeometryType::HalfEdgeTriangleMesh = 7,
  GeometryType::Image = 8, GeometryType::RGBDImage = 9, GeometryType::TetraMesh = 10, GeometryType::OrientedBoundingBox = 11,
  GeometryType::AxisAlignedBoundingBox = 12
}
 Specifies possible geometry types. More...
 
- Protected Member Functions inherited from open3d::geometry::Geometry3D
 Geometry3D (GeometryType type)
 Parameterized Constructor. More...
 
Eigen::Vector3d ComputeMinBound (const std::vector< Eigen::Vector3d > &points) const
 Compute min bound of a list points. More...
 
Eigen::Vector3d ComputeMaxBound (const std::vector< Eigen::Vector3d > &points) const
 Compute max bound of a list points. More...
 
Eigen::Vector3d ComputeCenter (const std::vector< Eigen::Vector3d > &points) const
 Computer center of a list of points. More...
 
void ResizeAndPaintUniformColor (std::vector< Eigen::Vector3d > &colors, const size_t size, const Eigen::Vector3d &color) const
 Resizes the colors vector and paints a uniform color. More...
 
void TransformPoints (const Eigen::Matrix4d &transformation, std::vector< Eigen::Vector3d > &points) const
 Transforms all points with the transformation matrix. More...
 
void TransformNormals (const Eigen::Matrix4d &transformation, std::vector< Eigen::Vector3d > &normals) const
 Transforms the normals with the transformation matrix. More...
 
void TranslatePoints (const Eigen::Vector3d &translation, std::vector< Eigen::Vector3d > &points, bool relative) const
 Apply translation to the geometry coordinates. More...
 
void ScalePoints (const double scale, std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d &center) const
 Scale the coordinates of all points by the scaling factor scale. More...
 
void RotatePoints (const Eigen::Matrix3d &R, std::vector< Eigen::Vector3d > &points, const Eigen::Vector3d &center) const
 Rotate all points with the rotation matrix R. More...
 
void RotateNormals (const Eigen::Matrix3d &R, std::vector< Eigen::Vector3d > &normals) const
 Rotate all normals with the rotation matrix R. More...
 
- Protected Member Functions inherited from open3d::geometry::Geometry
 Geometry (GeometryType type, int dimension)
 Parameterized Constructor. More...
 

Detailed Description

A bounding box oriented along an arbitrary frame of reference.

The oriented bounding box is defined by its center position, rotation maxtrix and extent.

Constructor & Destructor Documentation

◆ OrientedBoundingBox() [1/2]

open3d::geometry::OrientedBoundingBox::OrientedBoundingBox ( )
inline

Default constructor.

Creates an empty Oriented Bounding Box.

◆ OrientedBoundingBox() [2/2]

open3d::geometry::OrientedBoundingBox::OrientedBoundingBox ( const Eigen::Vector3d &  center,
const Eigen::Matrix3d &  R,
const Eigen::Vector3d &  extent 
)
inline

Parameterized constructor.

Parameters
centerSpecifies the center position of the bounding box.
RThe rotation matrix specifying the orientation of the bounding box with the original frame of reference.
extentThe extent of the bounding box.

◆ ~OrientedBoundingBox()

open3d::geometry::OrientedBoundingBox::~OrientedBoundingBox ( )
inlineoverride

Member Function Documentation

◆ Clear()

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

Clear all elements in the geometry.

Implements open3d::geometry::Geometry3D.

◆ CreateFromAxisAlignedBoundingBox()

OrientedBoundingBox open3d::geometry::OrientedBoundingBox::CreateFromAxisAlignedBoundingBox ( const AxisAlignedBoundingBox aabox)
static

Returns an oriented bounding box from the AxisAlignedBoundingBox.

Parameters
aaboxAxisAlignedBoundingBox object from which OrientedBoundingBox is created.

◆ CreateFromPoints()

OrientedBoundingBox open3d::geometry::OrientedBoundingBox::CreateFromPoints ( const std::vector< Eigen::Vector3d > &  points)
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)

◆ GetAxisAlignedBoundingBox()

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

Returns an axis-aligned bounding box of the geometry.

Implements open3d::geometry::Geometry3D.

◆ GetBoxPoints()

std::vector< Eigen::Vector3d > open3d::geometry::OrientedBoundingBox::GetBoxPoints ( ) const

Returns the eight points that define the bounding box.

 ------- x
/|

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

◆ GetCenter()

Eigen::Vector3d open3d::geometry::OrientedBoundingBox::GetCenter ( ) const
overridevirtual

Returns the center of the geometry coordinates.

Implements open3d::geometry::Geometry3D.

◆ GetMaxBound()

Eigen::Vector3d open3d::geometry::OrientedBoundingBox::GetMaxBound ( ) const
overridevirtual

Returns max bounds for geometry coordinates.

Implements open3d::geometry::Geometry3D.

◆ GetMinBound()

Eigen::Vector3d open3d::geometry::OrientedBoundingBox::GetMinBound ( ) const
overridevirtual

Returns min bounds for geometry coordinates.

Implements open3d::geometry::Geometry3D.

◆ GetOrientedBoundingBox()

OrientedBoundingBox open3d::geometry::OrientedBoundingBox::GetOrientedBoundingBox ( ) const
overridevirtual

Returns an oriented bounding box of the geometry.

Implements open3d::geometry::Geometry3D.

◆ GetPointIndicesWithinBoundingBox()

std::vector< size_t > open3d::geometry::OrientedBoundingBox::GetPointIndicesWithinBoundingBox ( const std::vector< Eigen::Vector3d > &  points) const

Return indices to points that are within the bounding box.

◆ IsEmpty()

bool open3d::geometry::OrientedBoundingBox::IsEmpty ( ) const
overridevirtual

Returns true iff the geometry is empty.

Implements open3d::geometry::Geometry3D.

◆ Rotate()

OrientedBoundingBox & open3d::geometry::OrientedBoundingBox::Rotate ( const Eigen::Matrix3d &  R,
const Eigen::Vector3d &  center 
)
overridevirtual

Rotates the oriented bounding boxs. Sets the rotation and center of the oriented bounding box to the given parameters.

Parameters
RNew rotation matrix of the oriented bounding box.
centerNew center of the oriented bounding box.

Implements open3d::geometry::Geometry3D.

◆ Scale()

OrientedBoundingBox & open3d::geometry::OrientedBoundingBox::Scale ( const double  scale,
const Eigen::Vector3d &  center 
)
overridevirtual

Scales the oriented bounding boxs. The extent parameter is multiplied by the scale factor and the center is set to the given parameter..

Parameters
scaleThe scale parameter that is multiplied to the extent parameter of the oriented bounding box.
centerNew center of the oriented bounding box.

Implements open3d::geometry::Geometry3D.

◆ Transform()

OrientedBoundingBox & open3d::geometry::OrientedBoundingBox::Transform ( const Eigen::Matrix4d &  transformation)
overridevirtual

Apply transformation (4x4 matrix) to the geometry coordinates.

Implements open3d::geometry::Geometry3D.

◆ Translate()

OrientedBoundingBox & open3d::geometry::OrientedBoundingBox::Translate ( const Eigen::Vector3d &  translation,
bool  relative = true 
)
overridevirtual

Apply translation to the geometry coordinates.

Parameters
translationA 3D vector to transform the geometry.
relativeIf true, the translation is directly applied to the geometry. Otherwise, the geometry center is moved to the translation.

Implements open3d::geometry::Geometry3D.

◆ Volume()

double open3d::geometry::OrientedBoundingBox::Volume ( ) const

Returns the volume of the bounding box.

Field Documentation

◆ center_

Eigen::Vector3d open3d::geometry::OrientedBoundingBox::center_

The center point of the bounding box.

◆ color_

Eigen::Vector3d open3d::geometry::OrientedBoundingBox::color_

The color of the bounding box in RGB.

◆ extent_

Eigen::Vector3d open3d::geometry::OrientedBoundingBox::extent_

The extent of the bounding box in its frame of reference.

◆ R_

Eigen::Matrix3d open3d::geometry::OrientedBoundingBox::R_

The rotation matrix of the bounding box to transform the original frame of reference to the frame of this box.


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