ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::OrientedBoundingBox Class Reference

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

#include <OrientedBoundingBox.h>

Inheritance diagram for cloudViewer::OrientedBoundingBox:

Public Member Functions

 OrientedBoundingBox ()
 Default constructor. More...
 
 OrientedBoundingBox (const Eigen::Vector3d &center, const Eigen::Matrix3d &R, const Eigen::Vector3d &extent)
 Parameterized constructor. More...
 
virtual ~OrientedBoundingBox ()
 
OrientedBoundingBoxClear ()
 
const Eigen::Vector3d & GetExtent () const
 
CCVector3 getCenter () const
 Returns center. More...
 
Eigen::Vector3d GetHalfExtent () const
 Returns the half extent of the bounding box in its frame of reference. More...
 
double GetMaxExtent () const
 Returns the max extent of the bounding box in its frame of reference. More...
 
void SetColor (const Eigen::Vector3d &color)
 Sets the bounding box color. More...
 
const Eigen::Vector3d & GetColor () const
 Gets the bounding box color. More...
 
const Eigen::Matrix3d & GetRotation () const
 
const Eigen::Vector3d & GetPosition () const
 
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...
 
std::vector< size_t > GetPointIndicesWithinBoundingBox (const std::vector< CCVector3 > &points) const
 

Static Public Member Functions

static OrientedBoundingBox CreateFromAxisAlignedBoundingBox (const BoundingBox &aabox)
 

Public Attributes

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...
 

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.

Definition at line 22 of file OrientedBoundingBox.h.

Constructor & Destructor Documentation

◆ OrientedBoundingBox() [1/2]

cloudViewer::OrientedBoundingBox::OrientedBoundingBox ( )
inline

Default constructor.

Creates an empty Oriented Bounding Box.

Definition at line 27 of file OrientedBoundingBox.h.

◆ OrientedBoundingBox() [2/2]

cloudViewer::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.

Definition at line 38 of file OrientedBoundingBox.h.

◆ ~OrientedBoundingBox()

virtual cloudViewer::OrientedBoundingBox::~OrientedBoundingBox ( )
inlinevirtual

Definition at line 42 of file OrientedBoundingBox.h.

Member Function Documentation

◆ Clear()

OrientedBoundingBox & OrientedBoundingBox::Clear ( )

Definition at line 22 of file OrientedBoundingBox.cpp.

References center_, color_, extent_, and R_.

Referenced by cloudViewer::geometry::pybind_boundingvolume().

◆ CreateFromAxisAlignedBoundingBox()

OrientedBoundingBox OrientedBoundingBox::CreateFromAxisAlignedBoundingBox ( const BoundingBox aabox)
static

Returns an oriented bounding box from the AxisAlignedBoundingBox.

Parameters
aaboxAxisAlignedBoundingBox object from which OrientedBoundingBox is created.

Definition at line 74 of file OrientedBoundingBox.cpp.

References center_, extent_, Vector3Tpl< double >::fromArray(), cloudViewer::BoundingBoxTpl< T >::getCenter(), cloudViewer::BoundingBoxTpl< T >::getDiagVec(), and R_.

◆ GetBoxPoints()

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

Returns the eight points that define the bounding box.

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

Definition at line 34 of file OrientedBoundingBox.cpp.

References center_, extent_, points, and R_.

Referenced by cloudViewer::geometry::pybind_boundingvolume().

◆ getCenter()

CCVector3 cloudViewer::OrientedBoundingBox::getCenter ( ) const
inline

Returns center.

Definition at line 52 of file OrientedBoundingBox.h.

References center_.

◆ GetColor()

const Eigen::Vector3d& cloudViewer::OrientedBoundingBox::GetColor ( ) const
inline

◆ GetExtent()

const Eigen::Vector3d& cloudViewer::OrientedBoundingBox::GetExtent ( ) const
inline

Get the extent/length of the bounding box in x, y, and z dimension in its frame of reference.

Definition at line 49 of file OrientedBoundingBox.h.

References extent_.

Referenced by cloudViewer::t::geometry::OrientedBoundingBox::FromLegacy(), and cloudViewer::geometry::pybind_boundingvolume().

◆ GetHalfExtent()

Eigen::Vector3d cloudViewer::OrientedBoundingBox::GetHalfExtent ( ) const
inline

Returns the half extent of the bounding box in its frame of reference.

Definition at line 55 of file OrientedBoundingBox.h.

Referenced by GetPointIndicesWithinBoundingBox(), and cloudViewer::geometry::pybind_boundingvolume().

◆ GetMaxExtent()

double cloudViewer::OrientedBoundingBox::GetMaxExtent ( ) const
inline

Returns the max extent of the bounding box in its frame of reference.

Definition at line 58 of file OrientedBoundingBox.h.

References extent_.

Referenced by cloudViewer::geometry::pybind_boundingvolume().

◆ GetPointIndicesWithinBoundingBox() [1/2]

std::vector< size_t > OrientedBoundingBox::GetPointIndicesWithinBoundingBox ( const std::vector< CCVector3 > &  points) const

◆ GetPointIndicesWithinBoundingBox() [2/2]

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

Return indices to points that are within the bounding box.

Definition at line 50 of file OrientedBoundingBox.cpp.

References Vector3Tpl< PointCoordinateType >::fromArrayContainer(), and points.

◆ GetPosition()

const Eigen::Vector3d& cloudViewer::OrientedBoundingBox::GetPosition ( ) const
inline

Definition at line 67 of file OrientedBoundingBox.h.

References center_.

Referenced by cloudViewer::t::geometry::OrientedBoundingBox::FromLegacy().

◆ GetRotation()

const Eigen::Matrix3d& cloudViewer::OrientedBoundingBox::GetRotation ( ) const
inline

Definition at line 65 of file OrientedBoundingBox.h.

References R_.

Referenced by cloudViewer::t::geometry::OrientedBoundingBox::FromLegacy().

◆ SetColor()

void cloudViewer::OrientedBoundingBox::SetColor ( const Eigen::Vector3d &  color)
inline

Sets the bounding box color.

Definition at line 61 of file OrientedBoundingBox.h.

References color.

Referenced by cloudViewer::geometry::pybind_boundingvolume(), and cloudViewer::t::geometry::OrientedBoundingBox::ToLegacy().

◆ volume()

double OrientedBoundingBox::volume ( ) const

Returns the volume of the bounding box.

Definition at line 30 of file OrientedBoundingBox.cpp.

References extent_.

Referenced by ecvOrientedBBox::IsEmpty(), and cloudViewer::geometry::pybind_boundingvolume().

Member Data Documentation

◆ center_

Eigen::Vector3d cloudViewer::OrientedBoundingBox::center_

◆ color_

Eigen::Vector3d cloudViewer::OrientedBoundingBox::color_

The color of the bounding box in RGB.

Definition at line 117 of file OrientedBoundingBox.h.

Referenced by Clear(), and cloudViewer::geometry::pybind_boundingvolume().

◆ extent_

Eigen::Vector3d cloudViewer::OrientedBoundingBox::extent_

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

Definition at line 115 of file OrientedBoundingBox.h.

Referenced by Clear(), CreateFromAxisAlignedBoundingBox(), GetBoxPoints(), cloudViewer::geometry::pybind_boundingvolume(), and volume().

◆ R_

Eigen::Matrix3d cloudViewer::OrientedBoundingBox::R_

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

Definition at line 113 of file OrientedBoundingBox.h.

Referenced by Clear(), CreateFromAxisAlignedBoundingBox(), GetBoxPoints(), GetPointIndicesWithinBoundingBox(), and cloudViewer::geometry::pybind_boundingvolume().


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