63 const size_t& child_index)
98 const Json::Value& value);
125 const std::shared_ptr<OctreeNodeInfo>& node_info,
126 const Eigen::Vector3d& point);
132 static std::function<std::shared_ptr<OctreeInternalNode>()>
138 static std::function<
void(std::shared_ptr<OctreeInternalNode>)>
166 static std::function<std::shared_ptr<OctreeInternalNode>()>
173 static std::function<
void(std::shared_ptr<OctreeInternalNode>)>
191 virtual std::shared_ptr<OctreeLeafNode>
Clone()
const = 0;
202 std::shared_ptr<OctreeLeafNode>
Clone()
const override;
208 static std::function<std::shared_ptr<OctreeLeafNode>()>
GetInitFunction();
216 static std::function<
void(std::shared_ptr<OctreeLeafNode>)>
223 Eigen::Vector3d
color_ = Eigen::Vector3d(0, 0, 0);
235 std::shared_ptr<OctreeLeafNode>
Clone()
const override;
241 static std::function<std::shared_ptr<OctreeLeafNode>()>
GetInitFunction();
250 static std::function<
void(std::shared_ptr<OctreeLeafNode>)>
285 const Eigen::Vector3d& origin,
299 Eigen::Vector3d
GetCenter()
const override;
302 bool robust =
false)
const override;
305 bool relative =
true)
override;
306 Octree&
Scale(
const double scale,
const Eigen::Vector3d& center)
override;
308 const Eigen::Vector3d& center)
override;
320 double size_expand = 0.01);
351 const Eigen::Vector3d& point,
352 const std::function<std::shared_ptr<OctreeLeafNode>()>& fl_init,
353 const std::function<
void(std::shared_ptr<OctreeLeafNode>)>&
355 const std::function<std::shared_ptr<OctreeInternalNode>()>&
357 const std::function<
void(std::shared_ptr<OctreeInternalNode>)>&
358 fi_update =
nullptr);
368 const std::function<
bool(
const std::shared_ptr<OctreeNode>&,
369 const std::shared_ptr<OctreeNodeInfo>&)>&
380 const std::function<
bool(
const std::shared_ptr<OctreeNode>&,
381 const std::shared_ptr<OctreeNodeInfo>&)>&
384 std::pair<std::shared_ptr<OctreeLeafNode>, std::shared_ptr<OctreeNodeInfo>>
399 const Eigen::Vector3d& origin,
406 std::shared_ptr<geometry::VoxelGrid>
ToVoxelGrid()
const;
412 static void TraverseRecurse(
413 const std::shared_ptr<OctreeNode>& node,
414 const std::shared_ptr<OctreeNodeInfo>& node_info,
415 const std::function<
bool(
const std::shared_ptr<OctreeNode>&,
416 const std::shared_ptr<OctreeNodeInfo>&)>&
419 void InsertPointRecurse(
420 const std::shared_ptr<OctreeNode>& node,
421 const std::shared_ptr<OctreeNodeInfo>& node_info,
422 const Eigen::Vector3d& point,
423 const std::function<std::shared_ptr<OctreeLeafNode>()>& f_l_init,
424 const std::function<
void(std::shared_ptr<OctreeLeafNode>)>&
426 const std::function<std::shared_ptr<OctreeInternalNode>()>&
428 const std::function<
void(std::shared_ptr<OctreeInternalNode>)>&
math::float4 color
Definition: LineSetBuffers.cpp:64
A bounding box that is aligned along the coordinate axes.
Definition: BoundingVolume.h:155
The base geometry class for 3D geometries.
Definition: Geometry3D.h:47
The base geometry class.
Definition: Geometry.h:37
GeometryType
Specifies possible geometry types.
Definition: Geometry.h:42
OctreeColorLeafNode class is an OctreeLeafNode containing color.
Definition: Octree.h:197
bool ConvertToJsonValue(Json::Value &value) const override
Definition: Octree.cpp:251
Eigen::Vector3d color_
Definition: Octree.h:223
bool operator==(const OctreeLeafNode &other) const override
Definition: Octree.cpp:241
std::shared_ptr< OctreeLeafNode > Clone() const override
Clone this OctreeLeafNode.
Definition: Octree.cpp:235
static std::function< std::shared_ptr< OctreeLeafNode >)> GetInitFunction()
Get lambda function for initializing OctreeLeafNode.
Definition: Octree.cpp:213
bool ConvertFromJsonValue(const Json::Value &value) override
Definition: Octree.cpp:256
static std::function< void(std::shared_ptr< OctreeLeafNode >)> GetUpdateFunction(const Eigen::Vector3d &color)
Get lambda function for updating OctreeLeafNode.
Definition: Octree.cpp:220
Octree datastructure.
Definition: Octree.h:263
void ConvertFromPointCloud(const geometry::PointCloud &point_cloud, double size_expand=0.01)
Convert octree from point cloud.
Definition: Octree.cpp:558
std::shared_ptr< OctreeNode > root_node_
Root of the octree.
Definition: Octree.h:323
Eigen::Vector3d GetCenter() const override
Returns the center of the geometry coordinates.
Definition: Octree.cpp:521
bool IsEmpty() const override
Returns true iff the geometry is empty.
Definition: Octree.cpp:503
bool ConvertToJsonValue(Json::Value &value) const override
Definition: Octree.cpp:768
Octree & Clear() override
Clear all elements in the geometry.
Definition: Octree.cpp:495
bool operator==(const Octree &other) const
Returns true if the Octree is completely the same, used for testing.
Definition: Octree.cpp:400
Eigen::Vector3d origin_
Definition: Octree.h:327
std::pair< std::shared_ptr< OctreeLeafNode >, std::shared_ptr< OctreeNodeInfo > > LocateLeafNode(const Eigen::Vector3d &point) const
Returns leaf OctreeNode and OctreeNodeInfo where the querypoint should reside.
Definition: Octree.cpp:739
Eigen::Vector3d GetMinBound() const override
Returns min bounds for geometry coordinates.
Definition: Octree.cpp:505
bool ConvertFromJsonValue(const Json::Value &value) override
Definition: Octree.cpp:782
Octree & Rotate(const Eigen::Matrix3d &R, const Eigen::Vector3d ¢er) override
Apply rotation to the geometry coordinates and normals. Given a rotation matrix , and center ,...
Definition: Octree.cpp:552
double size_
Definition: Octree.h:331
AxisAlignedBoundingBox GetAxisAlignedBoundingBox() const override
Returns an axis-aligned bounding box of the geometry.
Definition: Octree.cpp:525
void CreateFromVoxelGrid(const geometry::VoxelGrid &voxel_grid)
Convert from voxel grid.
Definition: Octree.cpp:803
Octree & Transform(const Eigen::Matrix4d &transformation) override
Apply transformation (4x4 matrix) to the geometry coordinates.
Definition: Octree.cpp:537
Octree & Translate(const Eigen::Vector3d &translation, bool relative=true) override
Apply translation to the geometry coordinates.
Definition: Octree.cpp:542
std::shared_ptr< geometry::VoxelGrid > ToVoxelGrid() const
Convert to VoxelGrid.
Definition: Octree.cpp:762
OrientedBoundingBox GetOrientedBoundingBox(bool robust=false) const override
Definition: Octree.cpp:532
static bool IsPointInBound(const Eigen::Vector3d &point, const Eigen::Vector3d &origin, const double &size)
Return true if point within bound, that is, origin <= point < origin + size.
Definition: Octree.cpp:675
void Traverse(const std::function< bool(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.
Definition: Octree.cpp:683
size_t max_depth_
Definition: Octree.h:335
Octree(const size_t &max_depth)
Parameterized Constructor.
Definition: Octree.h:274
Octree(const size_t &max_depth, const Eigen::Vector3d &origin, const double &size)
Parameterized Constructor.
Definition: Octree.h:284
~Octree() override
Definition: Octree.h:292
Octree()
Default Constructor.
Definition: Octree.h:266
void InsertPoint(const Eigen::Vector3d &point, const std::function< std::shared_ptr< OctreeLeafNode >()> &fl_init, const std::function< void(std::shared_ptr< OctreeLeafNode >)> &fl_update, const std::function< std::shared_ptr< OctreeInternalNode >()> &fi_init=nullptr, const std::function< void(std::shared_ptr< OctreeInternalNode >)> &fi_update=nullptr)
Insert a point to the octree.
Definition: Octree.cpp:591
Octree & Scale(const double scale, const Eigen::Vector3d ¢er) override
Apply scaling to the geometry coordinates. Given a scaling factor , and center , a given point is tr...
Definition: Octree.cpp:547
Eigen::Vector3d GetMaxBound() const override
Returns max bounds for geometry coordinates.
Definition: Octree.cpp:513
OctreeInternalNode class, containing OctreeNode children.
Definition: Octree.h:119
std::vector< std::shared_ptr< OctreeNode > > children_
Definition: Octree.h:149
static std::shared_ptr< OctreeNodeInfo > GetInsertionNodeInfo(const std::shared_ptr< OctreeNodeInfo > &node_info, const Eigen::Vector3d &point)
Definition: Octree.cpp:71
static std::function< std::shared_ptr< OctreeInternalNode >)> GetInitFunction()
Get lambda function for initializing OctreeInternalNode.
Definition: Octree.cpp:95
static std::function< void(std::shared_ptr< OctreeInternalNode >)> GetUpdateFunction()
Get lambda function for updating OctreeInternalNode.
Definition: Octree.cpp:102
bool ConvertFromJsonValue(const Json::Value &value) override
Definition: Octree.cpp:122
bool ConvertToJsonValue(Json::Value &value) const override
Definition: Octree.cpp:106
OctreeInternalNode()
Default Constructor.
Definition: Octree.h:123
OctreeInternalPointNode class is an OctreeInternalNode containing a list of indices which is the unio...
Definition: Octree.h:156
OctreeInternalPointNode()
Default Constructor.
Definition: Octree.h:160
std::vector< size_t > indices_
Indices of points associated with any children of this node.
Definition: Octree.h:181
bool ConvertFromJsonValue(const Json::Value &value) override
Definition: Octree.cpp:186
static std::function< std::shared_ptr< OctreeInternalNode >)> GetInitFunction()
Get lambda function for initializing OctreeInternalPointNode.
Definition: Octree.cpp:143
bool ConvertToJsonValue(Json::Value &value) const override
Definition: Octree.cpp:165
OctreeLeafNode base class.
Definition: Octree.h:187
virtual bool operator==(const OctreeLeafNode &other) const =0
virtual std::shared_ptr< OctreeLeafNode > Clone() const =0
Clone this OctreeLeafNode.
The base class for octree node.
Definition: Octree.h:89
OctreeNode()
Default Constructor.
Definition: Octree.h:93
static std::shared_ptr< OctreeNode > ConstructFromJsonValue(const Json::Value &value)
Factory function to construct an OctreeNode by parsing the json value.
Definition: Octree.cpp:43
virtual ~OctreeNode()
Definition: Octree.h:94
OctreeNode's information.
Definition: Octree.h:47
size_t child_index_
Definition: Octree.h:79
~OctreeNodeInfo()
Definition: Octree.h:68
OctreeNodeInfo(const Eigen::Vector3d &origin, const double &size, const size_t &depth, const size_t &child_index)
Parameterized Constructor.
Definition: Octree.h:60
double size_
Size of the node.
Definition: Octree.h:74
OctreeNodeInfo()
Default Constructor.
Definition: Octree.h:52
Eigen::Vector3d origin_
Origin coordinate of the node.
Definition: Octree.h:72
size_t depth_
Depth of the node to the root. The root is of depth 0.
Definition: Octree.h:76
OctreePointColorLeafNode class is an OctreeColorLeafNode containing a list of indices corresponding t...
Definition: Octree.h:231
static std::function< std::shared_ptr< OctreeLeafNode >)> GetInitFunction()
Get lambda function for initializing OctreeLeafNode.
Definition: Octree.cpp:270
bool ConvertToJsonValue(Json::Value &value) const override
Definition: Octree.cpp:316
std::vector< size_t > indices_
Associated point indices with this node.
Definition: Octree.h:257
static std::function< void(std::shared_ptr< OctreeLeafNode >)> GetUpdateFunction(size_t index, const Eigen::Vector3d &color)
Get lambda function for updating OctreeLeafNode.
Definition: Octree.cpp:277
bool operator==(const OctreeLeafNode &other) const override
Definition: Octree.cpp:303
bool ConvertFromJsonValue(const Json::Value &value) override
Definition: Octree.cpp:326
std::shared_ptr< OctreeLeafNode > Clone() const override
Clone this OctreeLeafNode.
Definition: Octree.cpp:296
A bounding box oriented along an arbitrary frame of reference.
Definition: BoundingVolume.h:44
A point cloud consists of point coordinates, and optionally point colors and point normals.
Definition: PointCloud.h:55
VoxelGrid is a collection of voxels which are aligned in grid.
Definition: VoxelGrid.h:80
Definition: IJsonConvertible.h:57
const char const char value recording_handle imu_sample void
Definition: K4aPlugin.cpp:269
Definition: PinholeCameraIntrinsic.cpp:35