OctreeShape.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_MATH_OCTREESHAPE_H
#define SURGSIM_MATH_OCTREESHAPE_H
#include "SurgSim/DataStructures/EmptyData.h"
#include "SurgSim/DataStructures/OctreeNode.h"
#include "SurgSim/Framework/Asset.h"
#include "SurgSim/Framework/ObjectFactory.h"
#include "SurgSim/Math/Shape.h"
namespace SurgSim
{
namespace Math
{
SURGSIM_STATIC_REGISTRATION(OctreeShape);
class OctreeShape : public Shape
{
public:
typedef SurgSim::DataStructures::OctreeNode<SurgSim::DataStructures::EmptyData> NodeType;
OctreeShape();
SURGSIM_CLASSNAME(SurgSim::Math::OctreeShape);
template<class T>
explicit OctreeShape(const SurgSim::DataStructures::OctreeNode<T>& node);
virtual ~OctreeShape();
int getType() const override;
double getVolume() const override;
Vector3d getCenter() const override;
Matrix33d getSecondMomentOfVolume() const override;
std::shared_ptr<NodeType> getOctree();
void setOctree(std::shared_ptr<SurgSim::Framework::Asset> node);
bool isValid() const override;
void loadOctree(const std::string& filePath);
const Math::Aabbd& getBoundingBox() const override;
private:
bool isValid(std::shared_ptr<NodeType> node) const;
std::shared_ptr<NodeType> m_rootNode;
};
}; // Math
}; // SurgSim
#include "SurgSim/Math/OctreeShape-inl.h"
#endif // SURGSIM_MATH_OCTREESHAPE_H
SurgSim::Math::OctreeShape::~OctreeShape
virtual ~OctreeShape()
Destructor.
Definition: OctreeShape.cpp:42
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Math::Shape::Vector3d
::SurgSim::Math::Vector3d Vector3d
Definition: Shape.h:68
SurgSim::Math::OctreeShape::NodeType
SurgSim::DataStructures::OctreeNode< SurgSim::DataStructures::EmptyData > NodeType
Definition: OctreeShape.h:37
ObjectFactory.h
SurgSim::Math::OctreeShape::getType
int getType() const override
Definition: OctreeShape.cpp:46
SurgSim::Math::OctreeShape::getOctree
std::shared_ptr< NodeType > getOctree()
Get the root node.
Definition: OctreeShape.cpp:79
Asset.h
SurgSim::Math::OctreeShape::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Math::OctreeShape)
SurgSim::Math::Aabbd
Eigen::AlignedBox< double, 3 > Aabbd
Wrapper around the Eigen type.
Definition: Aabb.h:30
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
OctreeNode.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::getVolume
double getVolume() const override
Get the volume of the shape.
Definition: OctreeShape.cpp:62
SurgSim::Math::OctreeShape::loadOctree
void loadOctree(const std::string &filePath)
Definition: OctreeShape.cpp:51
SurgSim::Math::Shape::Matrix33d
::SurgSim::Math::Matrix33d Matrix33d
Definition: Shape.h:69
OctreeShape-inl.h
Shape.h
SurgSim::Math::OctreeShape::isValid
bool isValid() const override
Definition: OctreeShape.cpp:100
SurgSim::Math::OctreeShape::OctreeShape
OctreeShape()
Constructor.
Definition: OctreeShape.cpp:29
SurgSim::Math::OctreeShape::getCenter
Vector3d getCenter() const override
Get the volumetric center of the shape.
Definition: OctreeShape.cpp:68
SurgSim::DataStructures::OctreeNode
Octree data structure.
Definition: OctreeNode.h:131
SurgSim::Math::OctreeShape
Octree Shape A defined by an octree data structure.
Definition: OctreeShape.h:34
SurgSim::Math::Shape
Generic rigid shape class defining a shape.
Definition: Shape.h:65
EmptyData.h
SurgSim::Math::OctreeShape::getBoundingBox
const Math::Aabbd & getBoundingBox() const override
Definition: OctreeShape.cpp:105