All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
35 {
36 public:
38 
40  OctreeShape();
41 
43 
49  template<class T>
51 
53  virtual ~OctreeShape();
54 
56  virtual int getType() override;
57 
60  virtual double getVolume() const override;
61 
64  virtual Vector3d getCenter() const override;
65 
69  virtual Matrix33d getSecondMomentOfVolume() const override;
70 
73  std::shared_ptr<NodeType> getRootNode();
74 
77  const std::shared_ptr<const NodeType> getRootNode() const;
78 
81  void setRootNode(std::shared_ptr<NodeType> node);
82 
84  virtual bool isValid() const override;
85 
86  virtual bool doLoad(const std::string& filePath) override;
87 
88 private:
90  std::shared_ptr<NodeType> m_rootNode;
91 };
92 
93 }; // Math
94 }; // SurgSim
95 
97 
98 #endif // SURGSIM_MATH_OCTREESHAPE_H
virtual ~OctreeShape()
Destructor.
Definition: OctreeShape.cpp:32
This class is used to facilitate file loading.
Definition: Asset.h:33
virtual bool doLoad(const std::string &filePath) override
Derived classes will overwrite this method to do actual loading.
Definition: OctreeShape.cpp:41
SURGSIM_STATIC_REGISTRATION(BoxShape)
::SurgSim::Math::Vector3d Vector3d
Definition: Shape.h:62
void setRootNode(std::shared_ptr< NodeType > node)
Set the root node.
Definition: OctreeShape.cpp:76
SurgSim::DataStructures::OctreeNode< SurgSim::DataStructures::EmptyData > NodeType
Definition: OctreeShape.h:37
SURGSIM_CLASSNAME(SurgSim::Math::OctreeShape)
std::shared_ptr< NodeType > getRootNode()
Get the root node.
Definition: OctreeShape.cpp:66
std::shared_ptr< NodeType > m_rootNode
Root node of the octree datastructure.
Definition: OctreeShape.h:90
virtual Matrix33d getSecondMomentOfVolume() const override
Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix...
Definition: OctreeShape.cpp:60
virtual int getType() override
Definition: OctreeShape.cpp:36
virtual double getVolume() const override
Get the volume of the shape.
Definition: OctreeShape.cpp:49
::SurgSim::Math::Matrix33d Matrix33d
Definition: Shape.h:63
virtual bool isValid() const override
Definition: OctreeShape.cpp:81
OctreeShape()
Constructor.
Definition: OctreeShape.cpp:27
virtual Vector3d getCenter() const override
Get the volumetric center of the shape.
Definition: OctreeShape.cpp:55
Octree data structure.
Definition: OctreeNode.h:128
Octree Shape A defined by an octree data structure.
Definition: OctreeShape.h:34
Generic rigid shape class defining a shape.
Definition: Shape.h:59