SphereShape.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_SPHERESHAPE_H
#define SURGSIM_MATH_SPHERESHAPE_H
#include "SurgSim/Framework/ObjectFactory.h"
#include "SurgSim/Math/Shape.h"
namespace SurgSim
{
namespace Math
{
SURGSIM_STATIC_REGISTRATION(SphereShape);
class SphereShape: public Shape
{
public:
explicit SphereShape(double radius = 0.0);
SURGSIM_CLASSNAME(SurgSim::Math::SphereShape);
int getType() const override;
double getRadius() const;
double getVolume() const override;
Vector3d getCenter() const override;
Matrix33d getSecondMomentOfVolume() const override;
bool isValid() const override;
protected:
// Setters in 'protected' sections are for serialization purpose only.
void setRadius(double radius);
void updateAabb();
private:
double m_radius;
};
}; // Math
}; // SurgSim
#endif // SURGSIM_MATH_SPHERESHAPE_H
SurgSim::Math::SphereShape::isValid
bool isValid() const override
Definition: SphereShape.cpp:76
SurgSim::Math::SphereShape::updateAabb
void updateAabb()
Definition: SphereShape.cpp:46
SurgSim::Math::SphereShape::SphereShape
SphereShape(double radius=0.0)
Constructor.
Definition: SphereShape.cpp:24
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Math::Shape::Vector3d
::SurgSim::Math::Vector3d Vector3d
Definition: Shape.h:68
SurgSim::Math::SphereShape::getRadius
double getRadius() const
Get the sphere radius.
Definition: SphereShape.cpp:35
SurgSim::Math::SphereShape::getSecondMomentOfVolume
Matrix33d getSecondMomentOfVolume() const override
Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix...
Definition: SphereShape.cpp:63
ObjectFactory.h
SurgSim::Math::SphereShape::m_radius
double m_radius
Sphere radius.
Definition: SphereShape.h:72
SurgSim::Math::SphereShape
Sphere shape: sphere centered on (0 0 0), defined with radius.
Definition: SphereShape.h:30
SurgSim::Math::SphereShape::getType
int getType() const override
Definition: SphereShape.cpp:30
SurgSim::Math::SphereShape::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Math::SphereShape)
SurgSim::Math::Shape::Matrix33d
::SurgSim::Math::Matrix33d Matrix33d
Definition: Shape.h:69
SurgSim::Math::SphereShape::getVolume
double getVolume() const override
Get the volume of the shape.
Definition: SphereShape.cpp:53
Shape.h
SurgSim::Math::SphereShape::setRadius
void setRadius(double radius)
Set the sphere radius.
Definition: SphereShape.cpp:40
SurgSim::Math::SphereShape::getCenter
Vector3d getCenter() const override
Get the volumetric center of the shape.
Definition: SphereShape.cpp:58
SurgSim::Math::Shape
Generic rigid shape class defining a shape.
Definition: Shape.h:65