DeformableCollisionRepresentation.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_DEFORMABLECOLLISIONREPRESENTATION_H
17 #define SURGSIM_PHYSICS_DEFORMABLECOLLISIONREPRESENTATION_H
18 
19 #include <memory>
20 #include <string>
21 
24 
25 namespace SurgSim
26 {
27 namespace Math
28 {
29 class Shape;
30 class MeshShape;
31 }
32 
33 namespace Physics
34 {
35 class DeformableRepresentation;
36 
37 SURGSIM_STATIC_REGISTRATION(DeformableCollisionRepresentation);
38 
43 {
44 public:
45 
48  explicit DeformableCollisionRepresentation(const std::string& name);
49 
52 
54 
58  void setShape(std::shared_ptr<SurgSim::Math::Shape> shape);
59 
60  const std::shared_ptr<SurgSim::Math::Shape> getShape() const override;
61 
64  void setDeformableRepresentation(std::shared_ptr<SurgSim::Physics::DeformableRepresentation> representation);
65 
67  const std::shared_ptr<SurgSim::Physics::DeformableRepresentation> getDeformableRepresentation() const;
68 
69  int getShapeType() const override;
70 
71  void updateDcdData() override;
72 
73  void updateCcdData(double interval) override;
74 
75  void updateShapeData() override;
76 
77 private:
78  bool doInitialize() override;
79  bool doWakeUp() override;
80 
82  std::shared_ptr<SurgSim::Math::Shape> m_shape, m_previousShape;
83 
85  std::weak_ptr<SurgSim::Physics::DeformableRepresentation> m_deformable;
86 };
87 
88 } // namespace Physics
89 } // namespace SurgSim
90 
91 #endif
SurgSim::Physics::DeformableCollisionRepresentation::m_shape
std::shared_ptr< SurgSim::Math::Shape > m_shape
Shape used for collision detection.
Definition: DeformableCollisionRepresentation.h:82
SurgSim::Physics::DeformableCollisionRepresentation
A collision representation that can be attached to a deformable, when this contains a mesh with the s...
Definition: DeformableCollisionRepresentation.h:42
SurgSim::Physics::DeformableCollisionRepresentation::getDeformableRepresentation
const std::shared_ptr< SurgSim::Physics::DeformableRepresentation > getDeformableRepresentation() const
Definition: DeformableCollisionRepresentation.cpp:145
SurgSim::Physics::DeformableCollisionRepresentation::~DeformableCollisionRepresentation
virtual ~DeformableCollisionRepresentation()
Destructor.
Definition: DeformableCollisionRepresentation.cpp:44
SurgSim::Physics::DeformableCollisionRepresentation::updateCcdData
void updateCcdData(double interval) override
Update the data (the motionShape) in preparation for a CCD contact calcul ation.
Definition: DeformableCollisionRepresentation.cpp:179
SurgSim::Physics::DeformableCollisionRepresentation::doWakeUp
bool doWakeUp() override
Interface to be implemented by derived classes.
Definition: DeformableCollisionRepresentation.cpp:98
SurgSim::Physics::DeformableCollisionRepresentation::updateDcdData
void updateDcdData() override
Update the data (the shape) in preparation for a DCD contact calculation.
Definition: DeformableCollisionRepresentation.cpp:173
SurgSim::Physics::DeformableCollisionRepresentation::setDeformableRepresentation
void setDeformableRepresentation(std::shared_ptr< SurgSim::Physics::DeformableRepresentation > representation)
Sets the deformable to which this collision representation is connected.
Definition: DeformableCollisionRepresentation.cpp:138
ObjectFactory.h
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Collision::Representation
The type of collision detection.
Definition: Representation.h:60
SurgSim::Physics::DeformableCollisionRepresentation::updateShapeData
void updateShapeData() override
Update the basic Shape's state from the physics state, so that the bounding box can correctly be dete...
Definition: DeformableCollisionRepresentation.cpp:156
SurgSim::Physics::DeformableCollisionRepresentation::getShapeType
int getShapeType() const override
Get the shape type id.
Definition: DeformableCollisionRepresentation.cpp:117
SurgSim::Physics::DeformableCollisionRepresentation::doInitialize
bool doInitialize() override
Interface to be implemented by derived classes.
Definition: DeformableCollisionRepresentation.cpp:87
SurgSim::Physics::DeformableCollisionRepresentation::m_previousShape
std::shared_ptr< SurgSim::Math::Shape > m_previousShape
Definition: DeformableCollisionRepresentation.h:82
Representation.h
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
SurgSim::Physics::DeformableCollisionRepresentation::getShape
const std::shared_ptr< SurgSim::Math::Shape > getShape() const override
Get the shape.
Definition: DeformableCollisionRepresentation.cpp:133
SurgSim::Physics::DeformableCollisionRepresentation::m_deformable
std::weak_ptr< SurgSim::Physics::DeformableRepresentation > m_deformable
Reference to the deformable driving changes to this mesh.
Definition: DeformableCollisionRepresentation.h:85
SurgSim::Physics::DeformableCollisionRepresentation::DeformableCollisionRepresentation
DeformableCollisionRepresentation(const std::string &name)
Constructor.
Definition: DeformableCollisionRepresentation.cpp:37
SurgSim::Physics::DeformableCollisionRepresentation::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Physics::DeformableCollisionRepresentation)
SurgSim::Physics::DeformableCollisionRepresentation::setShape
void setShape(std::shared_ptr< SurgSim::Math::Shape > shape)
Set the shape for this collision representation, has to be a SurgSim::Math::MeshShape.
Definition: DeformableCollisionRepresentation.cpp:123