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

A bounding box that is aligned along the coordinate axes. More...

#include <BoundingVolume.h>

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

Public Member Functions

 AxisAlignedBoundingBox ()
 Default constructor. More...
 
 AxisAlignedBoundingBox (const Eigen::Vector3d &min_bound, const Eigen::Vector3d &max_bound)
 Parameterized constructor. More...
 
 ~AxisAlignedBoundingBox () override
 
AxisAlignedBoundingBoxClear () 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 AxisAlignedBoundingBoxTransform (const Eigen::Matrix4d &transformation) override
 Apply transformation (4x4 matrix) to the geometry coordinates. More...
 
virtual AxisAlignedBoundingBoxTranslate (const Eigen::Vector3d &translation, bool relative=true) override
 Apply translation to the geometry coordinates. More...
 
virtual AxisAlignedBoundingBoxScale (const double scale, const Eigen::Vector3d &center) override
 Scales the axis-aligned bounding boxs. 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)$. More...
 
virtual AxisAlignedBoundingBoxRotate (const Eigen::Matrix3d &R, const Eigen::Vector3d &center) override
 an AxisAlignedBoundingBox can not be rotated. This method will throw an error. More...
 
AxisAlignedBoundingBoxoperator+= (const AxisAlignedBoundingBox &other)
 
Eigen::Vector3d GetExtent () const
 Get the extent/length of the bounding box in x, y, and z dimension. More...
 
Eigen::Vector3d GetHalfExtent () const
 Returns the half extent of the bounding box. More...
 
double GetMaxExtent () const
 
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...
 
std::vector< Eigen::Vector3d > GetBoxPoints () const
 Returns the eight points that define the bounding box. More...
 
std::vector< size_t > GetPointIndicesWithinBoundingBox (const std::vector< Eigen::Vector3d > &points) const
 
std::string GetPrintInfo () const
 Returns the 3D dimensions of the bounding box in string format. 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 AxisAlignedBoundingBox 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 min_bound_
 The lower x, y, z bounds of the bounding box. More...
 
Eigen::Vector3d max_bound_
 The upper x, y, z bounds of the bounding box. 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 that is aligned along the coordinate axes.

The AxisAlignedBoundingBox uses the cooridnate axes for bounding box generation. This means that the bounding box is oriented along the coordinate axes.

Constructor & Destructor Documentation

◆ AxisAlignedBoundingBox() [1/2]

open3d::geometry::AxisAlignedBoundingBox::AxisAlignedBoundingBox ( )
inline

Default constructor.

Creates an empty Axis Aligned Bounding Box.

◆ AxisAlignedBoundingBox() [2/2]

open3d::geometry::AxisAlignedBoundingBox::AxisAlignedBoundingBox ( const Eigen::Vector3d &  min_bound,
const Eigen::Vector3d &  max_bound 
)
inline

Parameterized constructor.

Parameters
min_boundLower bounds of the bounding box for all axes.
max_boundUpper bounds of the bounding box for all axes.

◆ ~AxisAlignedBoundingBox()

open3d::geometry::AxisAlignedBoundingBox::~AxisAlignedBoundingBox ( )
inlineoverride

Member Function Documentation

◆ Clear()

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

Clear all elements in the geometry.

Implements open3d::geometry::Geometry3D.

◆ CreateFromPoints()

AxisAlignedBoundingBox open3d::geometry::AxisAlignedBoundingBox::CreateFromPoints ( const std::vector< Eigen::Vector3d > &  points)
static

Creates the bounding box that encloses the set of points.

Parameters
pointsA list of points.

◆ GetAxisAlignedBoundingBox()

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

Returns an axis-aligned bounding box of the geometry.

Implements open3d::geometry::Geometry3D.

◆ GetBoxPoints()

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

Returns the eight points that define the bounding box.

◆ GetCenter()

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

Returns the center of the geometry coordinates.

Implements open3d::geometry::Geometry3D.

◆ GetExtent()

Eigen::Vector3d open3d::geometry::AxisAlignedBoundingBox::GetExtent ( ) const
inline

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

◆ GetHalfExtent()

Eigen::Vector3d open3d::geometry::AxisAlignedBoundingBox::GetHalfExtent ( ) const
inline

Returns the half extent of the bounding box.

◆ GetMaxBound()

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

Returns max bounds for geometry coordinates.

Implements open3d::geometry::Geometry3D.

◆ GetMaxExtent()

double open3d::geometry::AxisAlignedBoundingBox::GetMaxExtent ( ) const
inline

Returns the maximum extent, i.e. the maximum of X, Y and Z axis' extents.

◆ GetMinBound()

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

Returns min bounds for geometry coordinates.

Implements open3d::geometry::Geometry3D.

◆ GetOrientedBoundingBox()

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

Returns an oriented bounding box of the geometry.

Implements open3d::geometry::Geometry3D.

◆ GetPointIndicesWithinBoundingBox()

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

Return indices to points that are within the bounding box.

Parameters
pointsA list of points.

◆ GetPrintInfo()

std::string open3d::geometry::AxisAlignedBoundingBox::GetPrintInfo ( ) const

Returns the 3D dimensions of the bounding box in string format.

◆ GetXPercentage()

double open3d::geometry::AxisAlignedBoundingBox::GetXPercentage ( double  x) const
inline

◆ GetYPercentage()

double open3d::geometry::AxisAlignedBoundingBox::GetYPercentage ( double  y) const
inline

◆ GetZPercentage()

double open3d::geometry::AxisAlignedBoundingBox::GetZPercentage ( double  z) const
inline

◆ IsEmpty()

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

Returns true iff the geometry is empty.

Implements open3d::geometry::Geometry3D.

◆ operator+=()

AxisAlignedBoundingBox & open3d::geometry::AxisAlignedBoundingBox::operator+= ( const AxisAlignedBoundingBox other)

◆ Rotate()

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

an AxisAlignedBoundingBox can not be rotated. This method will throw an error.

Implements open3d::geometry::Geometry3D.

◆ Scale()

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

Scales the axis-aligned bounding boxs. 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)$.

Parameters
scaleThe scale parameter.
centerCenter used for the scaling operation.

Implements open3d::geometry::Geometry3D.

◆ Transform()

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

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

Implements open3d::geometry::Geometry3D.

◆ Translate()

AxisAlignedBoundingBox & open3d::geometry::AxisAlignedBoundingBox::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::AxisAlignedBoundingBox::Volume ( ) const

Returns the volume of the bounding box.

Field Documentation

◆ color_

Eigen::Vector3d open3d::geometry::AxisAlignedBoundingBox::color_

The color of the bounding box in RGB.

◆ max_bound_

Eigen::Vector3d open3d::geometry::AxisAlignedBoundingBox::max_bound_

The upper x, y, z bounds of the bounding box.

◆ min_bound_

Eigen::Vector3d open3d::geometry::AxisAlignedBoundingBox::min_bound_

The lower x, y, z bounds of the bounding box.


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