OctreeShape.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_MATH_OCTREESHAPE_H
17 #define SURGSIM_MATH_OCTREESHAPE_H
18 
23 #include "SurgSim/Math/Shape.h"
24 
25 namespace SurgSim
26 {
27 
28 namespace Math
29 {
30 SURGSIM_STATIC_REGISTRATION(OctreeShape);
31 
34 class OctreeShape : public Shape
35 {
36 public:
38 
40  OctreeShape();
41 
43 
49  template<class T>
51 
53  virtual ~OctreeShape();
54 
56  int getType() const override;
57 
60  double getVolume() const override;
61 
64  Vector3d getCenter() const override;
65 
69  Matrix33d getSecondMomentOfVolume() const override;
70 
73  std::shared_ptr<NodeType> getOctree();
74 
77  void setOctree(std::shared_ptr<SurgSim::Framework::Asset> node);
78 
80  bool isValid() const override;
81 
82  void loadOctree(const std::string& filePath);
83 
84  const Math::Aabbd& getBoundingBox() const override;
85 
86 private:
87 
90  bool isValid(std::shared_ptr<NodeType> node) const;
91 
93  std::shared_ptr<NodeType> m_rootNode;
94 };
95 
96 }; // Math
97 }; // SurgSim
98 
100 
101 #endif // SURGSIM_MATH_OCTREESHAPE_H
SurgSim::Math::OctreeShape
Octree Shape A defined by an octree data structure.
Definition: OctreeShape.h:35
Shape.h
SurgSim::Math::OctreeShape::NodeType
SurgSim::DataStructures::OctreeNode< SurgSim::DataStructures::EmptyData > NodeType
Definition: OctreeShape.h:37
SurgSim::Math::Shape::Matrix33d
::SurgSim::Math::Matrix33d Matrix33d
Definition: Shape.h:69
SurgSim::Math::OctreeShape::OctreeShape
OctreeShape()
Constructor.
Definition: OctreeShape.cpp:29
Asset.h
SurgSim::Math::OctreeShape::getSecondMomentOfVolume
Matrix33d getSecondMomentOfVolume() const override
Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix.
Definition: OctreeShape.cpp:73
SurgSim::Math::OctreeShape::getCenter
Vector3d getCenter() const override
Get the volumetric center of the shape.
Definition: OctreeShape.cpp:68
EmptyData.h
ObjectFactory.h
SurgSim
Definition: CompoundShapeToGraphics.cpp:30
SurgSim::Math::OctreeShape::getVolume
double getVolume() const override
Get the volume of the shape.
Definition: OctreeShape.cpp:62
SurgSim::Math::Aabbd
Eigen::AlignedBox< double, 3 > Aabbd
Wrapper around the Eigen type.
Definition: Aabb.h:30
SurgSim::Math::OctreeShape::~OctreeShape
virtual ~OctreeShape()
Destructor.
Definition: OctreeShape.cpp:42
OctreeShape-inl.h
SurgSim::DataStructures::OctreeNode
Octree data structure.
Definition: OctreeNode.h:133
OctreeNode.h
SurgSim::Math::Shape
Generic rigid shape class defining a shape.
Definition: Shape.h:66
SurgSim::Math::OctreeShape::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Math::OctreeShape)
SurgSim::Math::OctreeShape::getType
int getType() const override
Definition: OctreeShape.cpp:46
SurgSim::Math::Shape::Vector3d
::SurgSim::Math::Vector3d Vector3d
Definition: Shape.h:68
SurgSim::Math::OctreeShape::getBoundingBox
const Math::Aabbd & getBoundingBox() const override
Definition: OctreeShape.cpp:105
SurgSim::Math::OctreeShape::getOctree
std::shared_ptr< NodeType > getOctree()
Get the root node.
Definition: OctreeShape.cpp:79
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
SurgSim::Math::OctreeShape::m_rootNode
std::shared_ptr< NodeType > m_rootNode
Root node of the octree datastructure.
Definition: OctreeShape.h:93
SurgSim::Math::OctreeShape::setOctree
void setOctree(std::shared_ptr< SurgSim::Framework::Asset > node)
Set the root node.
Definition: OctreeShape.cpp:84
SurgSim::Math::OctreeShape::isValid
bool isValid() const override
Definition: OctreeShape.cpp:100
SurgSim::Math::OctreeShape::loadOctree
void loadOctree(const std::string &filePath)
Definition: OctreeShape.cpp:51