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 
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
SurgSim::Physics::Localization::~Localization
virtual ~Localization()
Destructor.
Definition: Localization.cpp:34
Vector.h
SurgSim::Math::RigidTransform3d
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
SurgSim::Physics::Localization
This class localize a point on a representation (representation specific)
Definition: Localization.h:39
SurgSim::Physics::Localization::doCalculateVelocity
virtual SurgSim::Math::Vector3d doCalculateVelocity(double time) const =0
Calculates the global velocity of this localization.
Assert.h
SurgSim::Math::Vector3d
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Physics::Localization::isValidRepresentation
virtual bool isValidRepresentation(std::shared_ptr< Representation > representation)
Definition: Localization.cpp:69
SurgSim::Physics::Localization::getRepresentation
std::shared_ptr< Representation > getRepresentation() const
Gets the representation.
Definition: Localization.cpp:50
SurgSim::Physics::Localization::doCalculatePosition
virtual SurgSim::Math::Vector3d doCalculatePosition(double time) const =0
Calculates the global position of this localization.
RigidTransform.h
SurgSim::Physics::Localization::m_representation
std::shared_ptr< Representation > m_representation
The representation on which the localization is defined.
Definition: Localization.h:101
SurgSim::Physics::Localization::Localization
Localization()
Default constructor.
Definition: Localization.cpp:26
SurgSim::Physics::Localization::calculateVelocity
SurgSim::Math::Vector3d calculateVelocity(double time=1.0) const
Calculates the global velocity of this localization.
Definition: Localization.cpp:62
SurgSim::Physics::Localization::setRepresentation
void setRepresentation(std::shared_ptr< Representation > representation)
Sets the representation.
Definition: Localization.cpp:38
SurgSim::Physics::Localization::getElementPose
virtual Math::RigidTransform3d getElementPose()
Find a pose that the localization is represented with respect to.
Definition: Localization.cpp:75
SurgSim::Physics::Localization::calculatePosition
SurgSim::Math::Vector3d calculatePosition(double time=1.0) const
Calculates the global position of this localization.
Definition: Localization.cpp:55
SurgSim::Physics::Localization::moveClosestTo
virtual bool moveClosestTo(const Math::Vector3d &point, bool *hasReachedEnd)
Definition: Localization.cpp:82