16 #ifndef SURGSIM_DATASTRUCTURES_OCTREENODE_H 17 #define SURGSIM_DATASTRUCTURES_OCTREENODE_H 23 #include "SurgSim/DataStructures/EmptyData.h" 24 #include "SurgSim/Framework/Asset.h" 26 #include "SurgSim/Math/Aabb.h" 37 namespace DataStructures
43 typedef std::vector<size_t> OctreePath;
51 size_t operator()(
const OctreePath& path)
const 56 result = (result << 3) | i;
59 return m_hasher(result);
62 std::hash<size_t> m_hasher;
68 NEIGHBORHOOD_NONE = 0x0,
69 NEIGHBORHOOD_FACE = 0x1,
70 NEIGHBORHOOD_EDGE = 0x2,
71 NEIGHBORHOOD_VERTEX = 0x4,
72 NEIGHBORHOOD_ALL = 0x1 | 0x2 | 0x4
103 OctreePath getNeighbor(
const OctreePath& origin,
const std::array<Symbol, 3>& direction);
110 std::vector<OctreePath> getNeighbors(
const OctreePath& origin,
int type);
112 template <
typename Data>
132 public std::enable_shared_from_this<OctreeNode<Data>>
156 std::string getClassName()
const override;
160 explicit OctreeNode(
const SurgSim::Math::Aabbd& boundingBox);
167 const SurgSim::Math::Aabbd& getBoundingBox()
const;
171 bool isActive()
const;
175 void setIsActive(
bool isActive);
179 bool hasChildren()
const;
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;
251 static std::string m_className;
257 #include "SurgSim/DataStructures/OctreeNode-inl.h" 259 #endif // SURGSIM_DATASTRUCTURES_OCTREENODE_H Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
SurgSim::Math::Aabbd m_boundingBox
The bounding box of the current OctreeNode.
Definition: OctreeNode.h:239
This class is used to facilitate file loading.
Definition: Asset.h:39
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
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
Subclass the OctreeNodePLyReaderDelegateBase class to enable processing of the templated data...
Definition: OctreeNode.h:113
Definitions of small fixed-size vector types.
bool m_hasChildren
True if the node has children.
Definition: OctreeNode.h:245
bool m_isActive
True if there is any data inside this node, including data held by children, children's children...
Definition: OctreeNode.h:242
Eigen::AlignedBox< double, 3 > AxisAlignedBoundingBox
Bounding box type for convenience.
Definition: OctreeNode.h:140
std::array< std::shared_ptr< OctreeNode< Data > >, 8 > m_children
The children of this node.
Definition: OctreeNode.h:248
Data data
Extra node data.
Definition: OctreeNode.h:224
Octree data structure.
Definition: OctreeNode.h:131
Octree Shape A defined by an octree data structure.
Definition: OctreeShape.h:34