opensurgsim
MassSpringLocalization.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_MASSSPRINGLOCALIZATION_H
17 #define SURGSIM_PHYSICS_MASSSPRINGLOCALIZATION_H
18 
19 #include "SurgSim/DataStructures/IndexedLocalCoordinate.h"
20 #include "SurgSim/DataStructures/OptionalValue.h"
21 #include "SurgSim/Physics/Localization.h"
22 
23 namespace SurgSim
24 {
25 namespace Physics
26 {
27 class MassSpringRepresentation;
28 
42 {
43 public:
46 
49  explicit MassSpringLocalization(std::shared_ptr<Representation> representation);
50 
52  virtual ~MassSpringLocalization();
53 
56  void setLocalNode(size_t nodeID);
57 
61 
65 
69 
73  bool isValidRepresentation(std::shared_ptr<Representation> representation) override;
74 
75  bool moveClosestTo(const Math::Vector3d& point, bool *hasReachedEnd) override;
76 
77  std::shared_ptr<Localization> doCopy() const override;
78 
79 private:
85  SurgSim::Math::Vector3d doCalculatePosition(double time) const override;
86 
87  SurgSim::Math::Vector3d doCalculateVelocity(double time) const override;
88 
93 };
94 
95 }; // namespace Physics
96 
97 }; // namespace SurgSim
98 
99 #endif // SURGSIM_PHYSICS_MASSSPRINGLOCALIZATION_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
A generic (size_t index, Vector coordinate) pair.
Definition: IndexedLocalCoordinate.h:29
const DataStructures::OptionalValue< SurgSim::DataStructures::IndexedLocalCoordinate > & getLocalPosition() const
Gets the local position.
Definition: MassSpringLocalization.cpp:72
void setLocalPosition(const SurgSim::DataStructures::IndexedLocalCoordinate &localPosition)
Sets the local position.
Definition: MassSpringLocalization.cpp:57
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
bool moveClosestTo(const Math::Vector3d &point, bool *hasReachedEnd) override
Definition: MassSpringLocalization.cpp:167
bool isValidRepresentation(std::shared_ptr< Representation > representation) override
Queries whether Representation can be assigned to this class.
Definition: MassSpringLocalization.cpp:157
void setLocalNode(size_t nodeID)
Sets the local node.
Definition: MassSpringLocalization.cpp:45
MassSpringLocalization()
Default constructor.
Definition: MassSpringLocalization.cpp:28
std::shared_ptr< Localization > doCopy() const override
Definition: MassSpringLocalization.cpp:224
virtual ~MassSpringLocalization()
Destructor.
Definition: MassSpringLocalization.cpp:40
This class localize a point on a representation (representation specific)
Definition: Localization.h:39
const DataStructures::OptionalValue< size_t > & getLocalNode() const
Gets the local node.
Definition: MassSpringLocalization.cpp:52
Implementation of Localization for MassSpringRepresentation.
Definition: MassSpringLocalization.h:41