CylinderShape.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_CYLINDERSHAPE_H
#define SURGSIM_MATH_CYLINDERSHAPE_H
#include "SurgSim/Framework/ObjectFactory.h"
#include "SurgSim/Math/Shape.h"
namespace SurgSim
{
namespace Math
{
SURGSIM_STATIC_REGISTRATION(CylinderShape);
class CylinderShape: public Shape
{
public:
explicit CylinderShape(double length = 0.0, double radius = 0.0);
SURGSIM_CLASSNAME(SurgSim::Math::CylinderShape);
int getType() const override;
double getLength() const;
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 setLength(double length);
void setRadius(double radius);
private:
void updateAabb();
double m_length;
double m_radius;
};
}; // Math
}; // SurgSim
#endif // SURGSIM_MATH_CYLINDERSHAPE_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Math::CylinderShape::isValid
bool isValid() const override
Definition: CylinderShape.cpp:92
SurgSim::Math::CylinderShape::getLength
double getLength() const
Get the cylinder length.
Definition: CylinderShape.cpp:36
SurgSim::Math::Shape::Vector3d
::SurgSim::Math::Vector3d Vector3d
Definition: Shape.h:68
SurgSim::Math::CylinderShape::CylinderShape
CylinderShape(double length=0.0, double radius=0.0)
Constructor.
Definition: CylinderShape.cpp:24
ObjectFactory.h
SurgSim::Math::CylinderShape::getSecondMomentOfVolume
Matrix33d getSecondMomentOfVolume() const override
Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix...
Definition: CylinderShape.cpp:76
SurgSim::Math::CylinderShape
Cylinder shape: centered on (0 0 0), aligned along Y, defined with length and radius.
Definition: CylinderShape.h:31
SurgSim::Math::CylinderShape::getCenter
Vector3d getCenter() const override
Get the volumetric center of the shape.
Definition: CylinderShape.cpp:71
SurgSim::Math::CylinderShape::getVolume
double getVolume() const override
Get the volume of the shape.
Definition: CylinderShape.cpp:66
SurgSim::Math::CylinderShape::getType
int getType() const override
Definition: CylinderShape.cpp:31
SurgSim::Math::CylinderShape::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Math::CylinderShape)
SurgSim::Math::CylinderShape::setLength
void setLength(double length)
Set the cylinder length.
Definition: CylinderShape.cpp:47
SurgSim::Math::CylinderShape::m_radius
double m_radius
The cylinder radius.
Definition: CylinderShape.h:87
SurgSim::Math::Shape::Matrix33d
::SurgSim::Math::Matrix33d Matrix33d
Definition: Shape.h:69
SurgSim::Math::CylinderShape::setRadius
void setRadius(double radius)
Set the cylinder radius.
Definition: CylinderShape.cpp:53
SurgSim::Math::CylinderShape::getRadius
double getRadius() const
Get the cylinder radius.
Definition: CylinderShape.cpp:41
Shape.h
SurgSim::Math::CylinderShape::m_length
double m_length
The cylinder length.
Definition: CylinderShape.h:84
SurgSim::Math::CylinderShape::updateAabb
void updateAabb()
Definition: CylinderShape.cpp:59
SurgSim::Math::Shape
Generic rigid shape class defining a shape.
Definition: Shape.h:65