opensurgsim
Localization.h
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 
88  std::shared_ptr<Localization> copy() const;
89 
90 private:
95  virtual SurgSim::Math::Vector3d doCalculatePosition(double time) const = 0;
96 
101  virtual SurgSim::Math::Vector3d doCalculateVelocity(double time) const = 0;
102 
104  virtual std::shared_ptr<Localization> doCopy() const = 0;
105 
107  std::shared_ptr<Representation> m_representation;
108 };
109 
110 } // namespace Physics
111 
112 } // namespace SurgSim
113 
114 #endif // SURGSIM_PHYSICS_LOCALIZATION_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
Definitions of 2x2 and 3x3 rigid (isometric) transforms.
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