Localization.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_PHYSICS_LOCALIZATION_H
17 #define SURGSIM_PHYSICS_LOCALIZATION_H
18 
19 #include <memory>
20 
21 #include "SurgSim/Math/Vector.h"
24 
25 namespace SurgSim
26 {
27 
28 namespace DataStructures
29 {
30 struct Location;
31 }
32 
33 namespace Physics
34 {
35 
36 class Representation;
37 
40 {
41 public:
43  Localization();
44 
47  explicit Localization(std::shared_ptr<Representation> representation);
48 
50  virtual ~Localization();
51 
54  void setRepresentation(std::shared_ptr<Representation> representation);
55 
58  std::shared_ptr<Representation> getRepresentation() const;
59 
65  SurgSim::Math::Vector3d calculatePosition(double time = 1.0) const;
66 
72  SurgSim::Math::Vector3d calculateVelocity(double time = 1.0) const;
73 
74  virtual bool isValidRepresentation(std::shared_ptr<Representation> representation);
75 
80  virtual Math::RigidTransform3d getElementPose();
81 
85  virtual bool moveClosestTo(const Math::Vector3d& point, bool *hasReachedEnd);
86 
87 private:
92  virtual SurgSim::Math::Vector3d doCalculatePosition(double time) const = 0;
93 
98  virtual SurgSim::Math::Vector3d doCalculateVelocity(double time) const = 0;
99 
101  std::shared_ptr<Representation> m_representation;
102 };
103 
104 } // namespace Physics
105 
106 } // namespace SurgSim
107 
108 #endif // SURGSIM_PHYSICS_LOCALIZATION_H
std::shared_ptr< Representation > m_representation
The representation on which the localization is defined.
Definition: Localization.h:101
Definition: CompoundShapeToGraphics.cpp:29
Definitions of 2x2 and 3x3 rigid (isometric) transforms.
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
The header that provides the assertion API.
Definitions of small fixed-size vector types.
This class localize a point on a representation (representation specific)
Definition: Localization.h:39
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57