All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Shape.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_SHAPE_H
17 #define SURGSIM_MATH_SHAPE_H
18 
21 #include "SurgSim/Math/Vector.h"
22 #include "SurgSim/Math/Matrix.h"
23 
24 namespace SurgSim
25 {
26 
27 namespace Math
28 {
29 
32 typedef enum
33 {
38 
41 typedef enum
42 {
54 } ShapeType;
55 
60 {
61 public:
64 
65  // Destructor
66  virtual ~Shape();
67 
69  virtual int getType() = 0;
70 
73  virtual double getVolume() const = 0;
74 
77  virtual Vector3d getCenter() const = 0;
78 
82  virtual Matrix33d getSecondMomentOfVolume() const = 0;
83 
85 
87  static FactoryType& getFactory();
88 
90  virtual std::string getClassName() const;
91 
94  virtual bool isValid() const = 0;
95 };
96 
97 }; // Math
98 }; // SurgSim
99 
100 #endif // SURGSIM_MATH_SHAPE_H
virtual double getVolume() const =0
Get the volume of the shape.
virtual Vector3d getCenter() const =0
Get the volumetric center of the shape.
::SurgSim::Math::Vector3d Vector3d
Definition: Shape.h:62
ShapeDirection
Type defining the shape direction for certain templatized shape (i.e.
Definition: Shape.h:32
Definition: Shape.h:45
An object factory, once a class is registered with the factory it can be used to create instances of ...
Definition: ObjectFactory.h:40
virtual ~Shape()
Definition: Shape.cpp:26
ShapeType
Fixed List of enums for the available Shape types, do not explicitly assign values, ShapeCount is used to determine the number of actual shape types.
Definition: Shape.h:41
virtual Matrix33d getSecondMomentOfVolume() const =0
Get the second central moment of the volume, commonly used to calculate the moment of inertia matrix...
static FactoryType & getFactory()
Definition: Shape.cpp:30
Definition: Shape.h:53
Definitions of small fixed-size square matrix types.
virtual int getType()=0
Definitions of small fixed-size vector types.
Definition: Shape.h:44
Mixin class for enabling a property system on OSS classes, the instance still needs to initialize pro...
Definition: Accessible.h:36
::SurgSim::Math::Matrix33d Matrix33d
Definition: Shape.h:63
virtual std::string getClassName() const
Get class name.
Definition: Shape.cpp:37
Eigen::Matrix< double, 3, 3, Eigen::RowMajor > Matrix33d
A 3x3 matrix of doubles.
Definition: Matrix.h:51
Definition: Shape.h:49
SurgSim::Framework::ObjectFactory< SurgSim::Math::Shape > FactoryType
Definition: Shape.h:84
Definition: Shape.h:51
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:56
Definition: Shape.h:43
Definition: Shape.h:48
virtual bool isValid() const =0
Check if the shape is valid.
Generic rigid shape class defining a shape.
Definition: Shape.h:59
Definition: Shape.h:50