All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CylinderShape.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_CYLINDERSHAPE_H
17 #define SURGSIM_MATH_CYLINDERSHAPE_H
18 
20 #include "SurgSim/Math/Shape.h"
21 
22 namespace SurgSim
23 {
24 
25 namespace Math
26 {
27 SURGSIM_STATIC_REGISTRATION(CylinderShape);
28 
31 class CylinderShape: public Shape
32 {
33 public:
37  CylinderShape(double length = 0.0, double radius = 0.0);
38 
40 
42  virtual int getType() override;
43 
46  double getLength() const;
47 
50  double getRadius() const;
51 
54  virtual double getVolume() const override;
55 
58  virtual Vector3d getCenter() const override;
59 
63  virtual Matrix33d getSecondMomentOfVolume() const override;
64 
66  virtual bool isValid() const override;
67 
68 protected:
69  // Setters in 'protected' sections are for serialization purpose only.
70 
73  void setLength(double length);
74 
77  void setRadius(double radius);
78 
79 private:
81  double m_length;
82 
84  double m_radius;
85 };
86 
87 }; // Math
88 }; // SurgSim
89 
90 #endif // SURGSIM_MATH_CYLINDERSHAPE_H
virtual bool isValid() const override
Definition: CylinderShape.cpp:82
SURGSIM_STATIC_REGISTRATION(BoxShape)
::SurgSim::Math::Vector3d Vector3d
Definition: Shape.h:62
CylinderShape(double length=0.0, double radius=0.0)
Constructor.
Definition: CylinderShape.cpp:24
virtual Matrix33d getSecondMomentOfVolume() const override
Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix...
Definition: CylinderShape.cpp:66
Cylinder shape: centered on (0 0 0), aligned along Y, defined with length and radius.
Definition: CylinderShape.h:31
virtual Vector3d getCenter() const override
Get the volumetric center of the shape.
Definition: CylinderShape.cpp:61
virtual double getVolume() const override
Get the volume of the shape.
Definition: CylinderShape.cpp:56
SURGSIM_CLASSNAME(SurgSim::Math::CylinderShape)
void setLength(double length)
Set the cylinder length.
Definition: CylinderShape.cpp:46
double getLength() const
Get the cylinder length.
Definition: CylinderShape.cpp:35
double m_radius
The cylinder radius.
Definition: CylinderShape.h:84
::SurgSim::Math::Matrix33d Matrix33d
Definition: Shape.h:63
void setRadius(double radius)
Set the cylinder radius.
Definition: CylinderShape.cpp:51
virtual int getType() override
Definition: CylinderShape.cpp:30
double getRadius() const
Get the cylinder radius.
Definition: CylinderShape.cpp:40
double m_length
The cylinder length.
Definition: CylinderShape.h:81
Generic rigid shape class defining a shape.
Definition: Shape.h:59