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:
[legend]

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 ()
 
OrientedBoundingBox & Clear ()
 
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.

Constructor & Destructor Documentation

◆ OrientedBoundingBox() [1/2]

cloudViewer::OrientedBoundingBox::OrientedBoundingBox ( )
inline

Default constructor.

Creates an empty Oriented Bounding Box.

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

◆ ~OrientedBoundingBox()

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

Member Function Documentation

◆ Clear()

OrientedBoundingBox & OrientedBoundingBox::Clear ( )

References center_, color_, extent_, and R_.

◆ CreateFromAxisAlignedBoundingBox()

OrientedBoundingBox OrientedBoundingBox::CreateFromAxisAlignedBoundingBox ( const BoundingBox &  aabox)
static

Returns an oriented bounding box from the AxisAlignedBoundingBox.

Parameters
aaboxAxisAlignedBoundingBox object from which OrientedBoundingBox is created.

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

References center_, extent_, points, and R_.

Referenced by cloudViewer::geometry::LineSet::CreateFromOrientedBoundingBox(), ecvOrientedBBox::GetAxisAlignedBoundingBox(), ecvOrientedBBox::GetMaxBound(), and ecvOrientedBBox::GetMinBound().

◆ getCenter()

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

Returns center.

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.

References extent_.

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

◆ GetHalfExtent()

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

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

Referenced by GetPointIndicesWithinBoundingBox().

◆ GetMaxExtent()

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

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

References extent_.

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

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

Referenced by ccPointCloud::crop(), ccPointCloud::Crop(), and ccMesh::Crop().

◆ GetPosition()

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

◆ GetRotation()

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

◆ SetColor()

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

◆ volume()

double OrientedBoundingBox::volume ( ) const

Returns the volume of the bounding box.

References extent_.

Referenced by ecvOrientedBBox::IsEmpty().

Member Data Documentation

◆ center_

◆ color_

Eigen::Vector3d cloudViewer::OrientedBoundingBox::color_

The color of the bounding box in RGB.

Referenced by Clear().

◆ extent_

Eigen::Vector3d cloudViewer::OrientedBoundingBox::extent_

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

Referenced by Clear(), ecvOrientedBBox::CreateFromAxisAlignedBoundingBox(), CreateFromAxisAlignedBoundingBox(), ecvOrientedBBox::CreateFromPoints(), GetBoxPoints(), GetPointIndicesWithinBoundingBox(), and ecvOrientedBBox::Rotate().


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