Open3D (C++ API)
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Member Functions | Data Fields
open3d::geometry::Octree Class Reference

#include <Octree.h>

Inheritance diagram for open3d::geometry::Octree:
open3d::geometry::Geometry3D open3d::utility::IJsonConvertible open3d::geometry::Geometry

Public Member Functions

 Octree ()
 
 Octree (const size_t &max_depth)
 
 Octree (const size_t &max_depth, const Eigen::Vector3d &origin, const double &size)
 
 Octree (const Octree &src_octree)
 
 ~Octree () override
 
OctreeClear () override
 Clear all elements in the geometry. More...
 
bool IsEmpty () const override
 Returns true iff the geometry is empty. More...
 
Eigen::Vector3d GetMinBound () const override
 Returns min bounds for geometry coordinates. More...
 
Eigen::Vector3d GetMaxBound () const override
 Returns max bounds for geometry coordinates. More...
 
Eigen::Vector3d GetCenter () const override
 Returns the center of the geometry coordinates. More...
 
AxisAlignedBoundingBox GetAxisAlignedBoundingBox () const override
 Returns an axis-aligned bounding box of the geometry. More...
 
OrientedBoundingBox GetOrientedBoundingBox () const override
 Returns an oriented bounding box of the geometry. More...
 
OctreeTransform (const Eigen::Matrix4d &transformation) override
 Apply transformation (4x4 matrix) to the geometry coordinates. More...
 
OctreeTranslate (const Eigen::Vector3d &translation, bool relative=true) override
 Apply translation to the geometry coordinates. More...
 
OctreeScale (const double scale, bool center=true) override
 Apply scaling to the geometry coordinates. More...
 
OctreeRotate (const Eigen::Matrix3d &R, bool center=true) override
 Apply rotation to the geometry coordinates and normals. More...
 
bool ConvertToJsonValue (Json::Value &value) const override
 
bool ConvertFromJsonValue (const Json::Value &value) override
 
void ConvertFromPointCloud (const geometry::PointCloud &point_cloud, double size_expand=0.01)
 
void InsertPoint (const Eigen::Vector3d &point, const std::function< std::shared_ptr< OctreeLeafNode >()> &f_init, const std::function< void(std::shared_ptr< OctreeLeafNode >)> &f_update)
 Insert point. More...
 
void Traverse (const std::function< void(const std::shared_ptr< OctreeNode > &, const std::shared_ptr< OctreeNodeInfo > &)> &f)
 
void Traverse (const std::function< void(const std::shared_ptr< OctreeNode > &, const std::shared_ptr< OctreeNodeInfo > &)> &f) const
 
std::pair< std::shared_ptr< OctreeLeafNode >, std::shared_ptr< OctreeNodeInfo > > LocateLeafNode (const Eigen::Vector3d &point) const
 
bool operator== (const Octree &other) const
 Returns true if the Octree is completely the same, used for testing. More...
 
std::shared_ptr< geometry::VoxelGridToVoxelGrid () const
 Convert to voxel grid. More...
 
void CreateFromVoxelGrid (const geometry::VoxelGrid &voxel_grid)
 Convert from voxel grid. 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...
 
- Public Member Functions inherited from open3d::utility::IJsonConvertible
virtual ~IJsonConvertible ()
 

Static Public Member Functions

static bool IsPointInBound (const Eigen::Vector3d &point, const Eigen::Vector3d &origin, const double &size)
 
- 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...
 
- Static Public Member Functions inherited from open3d::utility::IJsonConvertible
static bool EigenVector3dFromJsonArray (Eigen::Vector3d &vec, const Json::Value &value)
 
static bool EigenVector3dToJsonArray (const Eigen::Vector3d &vec, Json::Value &value)
 
static bool EigenVector4dFromJsonArray (Eigen::Vector4d &vec, const Json::Value &value)
 
static bool EigenVector4dToJsonArray (const Eigen::Vector4d &vec, Json::Value &value)
 
static bool EigenMatrix3dFromJsonArray (Eigen::Matrix3d &mat, const Json::Value &value)
 
static bool EigenMatrix3dToJsonArray (const Eigen::Matrix3d &mat, Json::Value &value)
 
static bool EigenMatrix4dFromJsonArray (Eigen::Matrix4d &mat, const Json::Value &value)
 
static bool EigenMatrix4dToJsonArray (const Eigen::Matrix4d &mat, Json::Value &value)
 
static bool EigenMatrix4dFromJsonArray (Eigen::Matrix4d_u &mat, const Json::Value &value)
 
static bool EigenMatrix4dToJsonArray (const Eigen::Matrix4d_u &mat, Json::Value &value)
 
static bool EigenMatrix6dFromJsonArray (Eigen::Matrix6d &mat, const Json::Value &value)
 
static bool EigenMatrix6dToJsonArray (const Eigen::Matrix6d &mat, Json::Value &value)
 
static bool EigenMatrix6dFromJsonArray (Eigen::Matrix6d_u &mat, const Json::Value &value)
 
static bool EigenMatrix6dToJsonArray (const Eigen::Matrix6d_u &mat, Json::Value &value)
 

Data Fields

std::shared_ptr< OctreeNoderoot_node_ = nullptr
 Root of the octree. More...
 
Eigen::Vector3d origin_
 
double size_
 
size_t max_depth_
 

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, bool 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, bool center) const
 Rotate all points with the rotation matrix R. More...
 
void RotateNormals (const Eigen::Matrix3d &R, std::vector< Eigen::Vector3d > &normals, bool center) 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...
 

Constructor & Destructor Documentation

◆ Octree() [1/4]

open3d::geometry::Octree::Octree ( )
inline

◆ Octree() [2/4]

open3d::geometry::Octree::Octree ( const size_t &  max_depth)
inline

◆ Octree() [3/4]

open3d::geometry::Octree::Octree ( const size_t &  max_depth,
const Eigen::Vector3d &  origin,
const double &  size 
)
inline

◆ Octree() [4/4]

open3d::geometry::Octree::Octree ( const Octree src_octree)

◆ ~Octree()

open3d::geometry::Octree::~Octree ( )
inlineoverride

Member Function Documentation

◆ Clear()

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

Clear all elements in the geometry.

Implements open3d::geometry::Geometry3D.

◆ ConvertFromJsonValue()

bool open3d::geometry::Octree::ConvertFromJsonValue ( const Json::Value &  value)
overridevirtual

◆ ConvertFromPointCloud()

void open3d::geometry::Octree::ConvertFromPointCloud ( const geometry::PointCloud point_cloud,
double  size_expand = 0.01 
)

◆ ConvertToJsonValue()

bool open3d::geometry::Octree::ConvertToJsonValue ( Json::Value &  value) const
overridevirtual

◆ CreateFromVoxelGrid()

void open3d::geometry::Octree::CreateFromVoxelGrid ( const geometry::VoxelGrid voxel_grid)

Convert from voxel grid.

◆ GetAxisAlignedBoundingBox()

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

Returns an axis-aligned bounding box of the geometry.

Implements open3d::geometry::Geometry3D.

◆ GetCenter()

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

Returns the center of the geometry coordinates.

Implements open3d::geometry::Geometry3D.

◆ GetMaxBound()

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

Returns max bounds for geometry coordinates.

Implements open3d::geometry::Geometry3D.

◆ GetMinBound()

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

Returns min bounds for geometry coordinates.

Implements open3d::geometry::Geometry3D.

◆ GetOrientedBoundingBox()

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

Returns an oriented bounding box of the geometry.

Implements open3d::geometry::Geometry3D.

◆ InsertPoint()

void open3d::geometry::Octree::InsertPoint ( const Eigen::Vector3d &  point,
const std::function< std::shared_ptr< OctreeLeafNode >()> &  f_init,
const std::function< void(std::shared_ptr< OctreeLeafNode >)> &  f_update 
)

Insert point.

◆ IsEmpty()

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

Returns true iff the geometry is empty.

Implements open3d::geometry::Geometry3D.

◆ IsPointInBound()

bool open3d::geometry::Octree::IsPointInBound ( const Eigen::Vector3d &  point,
const Eigen::Vector3d &  origin,
const double &  size 
)
static

Return true if point within bound, that is, origin <= point < origin + size

◆ LocateLeafNode()

std::pair< std::shared_ptr< OctreeLeafNode >, std::shared_ptr< OctreeNodeInfo > > open3d::geometry::Octree::LocateLeafNode ( const Eigen::Vector3d &  point) const

◆ operator==()

bool open3d::geometry::Octree::operator== ( const Octree other) const

Returns true if the Octree is completely the same, used for testing.

◆ Rotate()

Octree & open3d::geometry::Octree::Rotate ( const Eigen::Matrix3d &  R,
bool  center = true 
)
overridevirtual

Apply rotation to the geometry coordinates and normals.

Parameters
RA 3D vector that either defines the three angles for Euler rotation, or in the axis-angle representation the normalized vector defines the axis of rotation and the norm the angle around this axis.
centerIf true, the rotation is applied relative to the center of the geometry. Otherwise, the rotation is directly applied to the geometry, i.e. relative to the origin.

Implements open3d::geometry::Geometry3D.

◆ Scale()

Octree & open3d::geometry::Octree::Scale ( const double  scale,
bool  center = true 
)
overridevirtual

Apply scaling to the geometry coordinates.

Parameters
scaleThe scale parameter that is multiplied to the points/vertices of the geometry.
centerIf true, the scale is applied relative to the center of the geometry. Otherwise, the scale is directly applied to the geometry, i.e. relative to the origin.

Implements open3d::geometry::Geometry3D.

◆ ToVoxelGrid()

std::shared_ptr< geometry::VoxelGrid > open3d::geometry::Octree::ToVoxelGrid ( ) const

Convert to voxel grid.

◆ Transform()

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

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

Implements open3d::geometry::Geometry3D.

◆ Translate()

Octree & open3d::geometry::Octree::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.

◆ Traverse() [1/2]

void open3d::geometry::Octree::Traverse ( const std::function< void(const std::shared_ptr< OctreeNode > &, const std::shared_ptr< OctreeNodeInfo > &)> &  f)

DFS traversal of Octree from the root, with callback function called for each node

◆ Traverse() [2/2]

void open3d::geometry::Octree::Traverse ( const std::function< void(const std::shared_ptr< OctreeNode > &, const std::shared_ptr< OctreeNodeInfo > &)> &  f) const

Const version of Traverse. DFS traversal of Octree from the root, with callback function called for each node

Field Documentation

◆ max_depth_

size_t open3d::geometry::Octree::max_depth_

Max depth of octree. The depth is defined as the distance from the deepest leaf node to root. A tree with only the root node has depth 0.

◆ origin_

Eigen::Vector3d open3d::geometry::Octree::origin_

Global min bound (include). A point is within bound iff origin_ <= point < origin_ + size_

◆ root_node_

std::shared_ptr<OctreeNode> open3d::geometry::Octree::root_node_ = nullptr

Root of the octree.

◆ size_

double open3d::geometry::Octree::size_

Outer bounding box edge size for the whole octree. A point is within bound iff origin_ <= point < origin_ + size_


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