MassSpring3DRepresentation.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_BLOCKS_MASSSPRING3DREPRESENTATION_H
#define SURGSIM_BLOCKS_MASSSPRING3DREPRESENTATION_H
#include <array>
#include <vector>
#include "SurgSim/Physics/MassSpringRepresentation.h"
namespace SurgSim
{
namespace Blocks
{
// This class defines a simple MassSpring 3D structures
class MassSpring3DRepresentation : public SurgSim::Physics::MassSpringRepresentation
{
public:
explicit MassSpring3DRepresentation(const std::string& name) :
SurgSim::Physics::MassSpringRepresentation(name)
{
}
void init3D(
const std::array<std::array<std::array<SurgSim::Math::Vector3d, 2>, 2>, 2> extremities,
size_t numNodesPerDim[3],
std::vector<size_t> nodeBoundaryConditions,
double totalMass,
double stiffnessStretching, double dampingStretching,
double stiffnessBending, double dampingBending,
double stiffnessFaceDiagonal, double dampingFaceDiagonal,
double stiffnessVolumeDiagonal, double dampingVolumeDiagonal);
private:
void init3DStretchingSprings(const std::shared_ptr<SurgSim::Math::OdeState> state,
size_t numNodesPerDim[3], double stiffness, double damping);
void init3DBendingSprings(const std::shared_ptr<SurgSim::Math::OdeState> state,
size_t numNodesPerDim[3], double stiffness, double damping);
void init3DFaceDiagonalSprings(const std::shared_ptr<SurgSim::Math::OdeState> state,
size_t numNodesPerDim[3], double stiffness, double damping);
void init3DVolumeDiagonalSprings(const std::shared_ptr<SurgSim::Math::OdeState> state,
size_t numNodesPerDim[3], double stiffness, double damping);
};
}; // namespace Blocks
}; // namespace SurgSim
#endif // SURGSIM_BLOCKS_MASSSPRING3DREPRESENTATION_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Blocks::MassSpring3DRepresentation::init3DStretchingSprings
void init3DStretchingSprings(const std::shared_ptr< SurgSim::Math::OdeState > state, size_t numNodesPerDim[3], double stiffness, double damping)
Helper method to initialize/add all stretching springs on a 3D structure.
Definition: MassSpring3DRepresentation.cpp:30
SurgSim::Blocks::MassSpring3DRepresentation::init3DBendingSprings
void init3DBendingSprings(const std::shared_ptr< SurgSim::Math::OdeState > state, size_t numNodesPerDim[3], double stiffness, double damping)
Helper method to initialize/add all bending springs on a 3D structure.
Definition: MassSpring3DRepresentation.cpp:79
SurgSim::Physics::MassSpringRepresentation
MassSpring model is a deformable model (a set of masses connected by springs).
Definition: MassSpringRepresentation.h:38
SurgSim::Blocks::MassSpring3DRepresentation
Definition: MassSpring3DRepresentation.h:31
SurgSim::Physics::MassSpringRepresentation::MassSpringRepresentation
MassSpringRepresentation(const std::string &name)
Constructor.
Definition: MassSpringRepresentation.cpp:35
SurgSim::Blocks::MassSpring3DRepresentation::init3DFaceDiagonalSprings
void init3DFaceDiagonalSprings(const std::shared_ptr< SurgSim::Math::OdeState > state, size_t numNodesPerDim[3], double stiffness, double damping)
Helper method to initialize/add all face diagonal springs on a 3D structure.
Definition: MassSpring3DRepresentation.cpp:128
SurgSim::Blocks::MassSpring3DRepresentation::init3D
void init3D(const std::array< std::array< std::array< SurgSim::Math::Vector3d, 2 >, 2 >, 2 > extremities, size_t numNodesPerDim[3], std::vector< size_t > nodeBoundaryConditions, double totalMass, double stiffnessStretching, double dampingStretching, double stiffnessBending, double dampingBending, double stiffnessFaceDiagonal, double dampingFaceDiagonal, double stiffnessVolumeDiagonal, double dampingVolumeDiagonal)
Initializes a 3D model.
Definition: MassSpring3DRepresentation.cpp:211
MassSpringRepresentation.h
SurgSim::Blocks::MassSpring3DRepresentation::init3DVolumeDiagonalSprings
void init3DVolumeDiagonalSprings(const std::shared_ptr< SurgSim::Math::OdeState > state, size_t numNodesPerDim[3], double stiffness, double damping)
Helper method to initialize/add all volume diagonal springs on a 3D structure.
Definition: MassSpring3DRepresentation.cpp:180
SurgSim::Blocks::MassSpring3DRepresentation::MassSpring3DRepresentation
MassSpring3DRepresentation(const std::string &name)
Constructor.
Definition: MassSpring3DRepresentation.h:36