Go to the documentation of this file.
16 #ifndef SURGSIM_DATASTRUCTURES_OCTREENODE_H
17 #define SURGSIM_DATASTRUCTURES_OCTREENODE_H
37 namespace DataStructures
56 result = (result << 3) | i;
112 template <
typename Data>
132 public std::enable_shared_from_this<OctreeNode<Data>>
197 std::array<std::shared_ptr<OctreeNode<Data>>, 8>&
getChildren();
201 const std::array<std::shared_ptr<OctreeNode<Data>>, 8>&
getChildren()
const;
207 std::shared_ptr<OctreeNode<Data>>
getChild(
size_t index);
213 const std::shared_ptr<OctreeNode<Data>>
getChild(
size_t index)
const;
221 virtual std::shared_ptr<OctreeNode<Data>>
getNode(
const OctreePath& path,
bool returnLastValid =
false);
234 const int currentLevel);
236 bool doLoad(
const std::string& filePath)
override;
259 #endif // SURGSIM_DATASTRUCTURES_OCTREENODE_H
Octree Shape A defined by an octree data structure.
Definition: OctreeShape.h:34
Definition: OctreeNode.h:70
Definition: OctreeNode.h:72
std::array< std::shared_ptr< OctreeNode< Data > >, 8 > m_children
The children of this node.
Definition: OctreeNode.h:248
Symbol
Direction code for the neighborhood search.
Definition: OctreeNode.h:76
virtual std::shared_ptr< OctreeNode< Data > > getNode(const OctreePath &path, bool returnLastValid=false)
Get the node at the supplied path.
Definition: OctreeNode-inl.h:216
virtual ~OctreeNode()
Destructor.
Definition: OctreeNode-inl.h:97
Definition: OctreeNode.h:81
bool doLoad(const std::string &filePath) override
Derived classes will overwrite this method to do actual loading.
Definition: OctreeNode-inl.h:241
std::array< std::shared_ptr< OctreeNode< Data > >, 8 > & getChildren()
Get the children of this node (non const version)
Definition: OctreeNode-inl.h:192
Definition: OctreeNode.h:83
OctreeNode()
Constructor.
Definition: OctreeNode-inl.h:36
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
bool isActive() const
Is this node active.
Definition: OctreeNode-inl.h:114
Definition: CompoundShapeToGraphics.cpp:29
std::vector< size_t > OctreePath
Typedef of octree path The path is a vector of children indexes (each within 0 to 7) that lead to the...
Definition: OctreeNode.h:43
Definition: OctreeNode.h:84
SurgSim::DataStructures::OctreePath getNeighbor(const OctreePath &origin, const std::array< Symbol, 3 > &direction)
Calculate the neighbor of an node in the octree by traversing a state machine, see http://ww1....
Definition: OctreeNode.cpp:155
size_t operator()(const OctreePath &path) const
Definition: OctreeNode.h:51
std::string getClassName() const override
Support serialization with a classname.
Definition: OctreeNode-inl.h:102
Definition: OctreeNode.h:82
SurgSim::Math::Aabbd m_boundingBox
The bounding box of the current OctreeNode.
Definition: OctreeNode.h:239
Eigen::AlignedBox< double, 3 > Aabbd
Wrapper around the Eigen type.
Definition: Aabb.h:30
std::shared_ptr< OctreeNode< Data > > getChild(size_t index)
Get a child of this node (non const version)
Definition: OctreeNode-inl.h:204
Subclass the OctreeNodePLyReaderDelegateBase class to enable processing of the templated data,...
Definition: OctreeNode.h:113
std::hash< size_t > m_hasher
Definition: OctreeNode.h:62
bool addData(const SurgSim::Math::Vector3d &position, const int level, const Data &nodeData=Data())
Add data to a node in this octree The octree will build the octree as necessary to add the node at th...
Definition: OctreeNode-inl.h:155
void subdivide()
Subdivide the node into 8 equal regions.
Definition: OctreeNode-inl.h:132
Definition: OctreeNode.h:68
Neighborhood
Indicates what neighbors to grab.
Definition: OctreeNode.h:66
Definition: OctreeNode.h:78
std::vector< OctreePath > getNeighbors(const OctreePath &origin, int type)
Fetch a list of neighbors, indicated by the type, Face, Edge and Vertex are possible types and can be...
Definition: OctreeNode.cpp:216
Octree data structure.
Definition: OctreeNode.h:131
Definition: OctreeNode.h:71
Definition: OctreeNode.h:79
bool hasChildren() const
Does this node have children.
Definition: OctreeNode-inl.h:126
bool m_hasChildren
True if the node has children.
Definition: OctreeNode.h:245
Enable the OctreePath to be used as a key in an unordered map, if the int range is exceeded this will...
Definition: OctreeNode.h:48
bool doAddData(const SurgSim::Math::Vector3d &position, const Data &nodeData, const int level, const int currentLevel)
Recursive function that does the adding of the data to the octree.
Definition: OctreeNode-inl.h:161
Eigen::AlignedBox< double, 3 > AxisAlignedBoundingBox
Bounding box type for convenience.
Definition: OctreeNode.h:140
void setIsActive(bool isActive)
Set active flag for this octree node.
Definition: OctreeNode-inl.h:120
This class is used to facilitate file loading.
Definition: Asset.h:39
Definition: OctreeNode.h:80
bool m_isActive
True if there is any data inside this node, including data held by children, children's children,...
Definition: OctreeNode.h:242
Data data
Extra node data.
Definition: OctreeNode.h:224
const SurgSim::Math::Aabbd & getBoundingBox() const
Get the bounding box for this octree node.
Definition: OctreeNode-inl.h:108
Definition: OctreeNode.h:69
static std::string m_className
Definition: OctreeNode.h:251