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
Definition: CompoundShapeToGraphics.cpp:29
std::shared_ptr< SurgSim::Math::Shape > m_shape
Shape used for collision detection.
Definition: DeformableCollisionRepresentation.h:82
A collision representation that can be attached to a deformable, when this contains a mesh with the s...
Definition: DeformableCollisionRepresentation.h:42
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
The type of collision detection.
Definition: Representation.h:60
std::weak_ptr< SurgSim::Physics::DeformableRepresentation > m_deformable
Reference to the deformable driving changes to this mesh.
Definition: DeformableCollisionRepresentation.h:85