MassSpring2DRepresentation.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_BLOCKS_MASSSPRING2DREPRESENTATION_H
17 #define SURGSIM_BLOCKS_MASSSPRING2DREPRESENTATION_H
18 
19 #include <array>
20 #include <vector>
21 
23 
24 namespace SurgSim
25 {
26 
27 namespace Blocks
28 {
29 
30 // This class defines a simple MassSpring 2D structures
32 {
33 public:
36  explicit MassSpring2DRepresentation(const std::string& name) :
37  SurgSim::Physics::MassSpringRepresentation(name)
38  {
39  }
40 
56  void init2D(const std::array<std::array<SurgSim::Math::Vector3d, 2>, 2> extremities,
57  size_t numNodesPerDim[2],
58  std::vector<size_t> nodeBoundaryConditions,
59  double totalMass,
60  double stiffnessStretching, double dampingStretching,
61  double stiffnessBending, double dampingBending,
62  double stiffnessFaceDiagonal, double dampingFaceDiagonal);
63 
64 private:
69  void init2DStretchingSprings(const std::shared_ptr<SurgSim::Math::OdeState> state,
70  size_t numNodesPerDim[2], double stiffness, double damping);
75  void init2DBendingSprings(const std::shared_ptr<SurgSim::Math::OdeState> state,
76  size_t numNodesPerDim[2], double stiffness, double damping);
81  void init2DFaceDiagonalSprings(const std::shared_ptr<SurgSim::Math::OdeState> state,
82  size_t numNodesPerDim[2], double stiffness, double damping);
83 };
84 
85 }; // namespace Blocks
86 
87 }; // namespace SurgSim
88 
89 #endif // SURGSIM_BLOCKS_MASSSPRING2DREPRESENTATION_H
Definition: CompoundShapeToGraphics.cpp:29
MassSpring2DRepresentation(const std::string &name)
Constructor.
Definition: MassSpring2DRepresentation.h:36
void init2D(const std::array< std::array< SurgSim::Math::Vector3d, 2 >, 2 > extremities, size_t numNodesPerDim[2], std::vector< size_t > nodeBoundaryConditions, double totalMass, double stiffnessStretching, double dampingStretching, double stiffnessBending, double dampingBending, double stiffnessFaceDiagonal, double dampingFaceDiagonal)
Initializes a 2D MassSpring.
Definition: MassSpring2DRepresentation.cpp:111
MassSpring model is a deformable model (a set of masses connected by springs).
Definition: MassSpringRepresentation.h:38
Definition: MassSpring2DRepresentation.h:31
MassSpringRepresentation(const std::string &name)
Constructor.
Definition: MassSpringRepresentation.cpp:35
void init2DBendingSprings(const std::shared_ptr< SurgSim::Math::OdeState > state, size_t numNodesPerDim[2], double stiffness, double damping)
Helper method to initialize/add all bending springs on a 2D structure.
Definition: MassSpring2DRepresentation.cpp:60
void init2DStretchingSprings(const std::shared_ptr< SurgSim::Math::OdeState > state, size_t numNodesPerDim[2], double stiffness, double damping)
Helper method to initialize/add all stretching springs on a 2D structure.
Definition: MassSpring2DRepresentation.cpp:30
void init2DFaceDiagonalSprings(const std::shared_ptr< SurgSim::Math::OdeState > state, size_t numNodesPerDim[2], double stiffness, double damping)
Helper method to initialize/add all face diagonal springs on a 2D structure.
Definition: MassSpring2DRepresentation.cpp:90