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 DataStructures
28 {
29 class TriangleMesh;
30 }
31 
32 namespace Math
33 {
34 class Shape;
35 class MeshShape;
36 }
37 
38 namespace Physics
39 {
40 class DeformableRepresentation;
41 
42 SURGSIM_STATIC_REGISTRATION(DeformableCollisionRepresentation);
43 
48 {
49 public:
50 
53  explicit DeformableCollisionRepresentation(const std::string& name);
54 
57 
59 
64  void setMesh(std::shared_ptr<SurgSim::DataStructures::TriangleMesh> mesh);
65 
67  std::shared_ptr<SurgSim::DataStructures::TriangleMesh> getMesh() const;
68 
72  void setShape(std::shared_ptr<SurgSim::Math::Shape> shape);
73 
74  virtual const std::shared_ptr<SurgSim::Math::Shape> getShape() const override;
75 
78  void setDeformableRepresentation(std::shared_ptr<SurgSim::Physics::DeformableRepresentation> representation);
79 
81  const std::shared_ptr<SurgSim::Physics::DeformableRepresentation> getDeformableRepresentation() const;
82 
83  virtual int getShapeType() const override;
84 
85  virtual void update(const double& dt) override;
86 
87 private:
88  virtual bool doInitialize() override;
89  virtual bool doWakeUp() override;
90 
92  std::shared_ptr<SurgSim::Math::MeshShape> m_shape;
93 
95  std::shared_ptr<SurgSim::DataStructures::TriangleMesh> m_mesh;
96 
98  std::weak_ptr<SurgSim::Physics::DeformableRepresentation> m_deformable;
99 };
100 
101 } // namespace Physics
102 } // namespace SurgSim
103 
104 #endif
Definition: DriveElementFromInputBehavior.cpp:27
SURGSIM_STATIC_REGISTRATION(SerializationMockComponent)
std::shared_ptr< SurgSim::DataStructures::TriangleMesh > m_mesh
Mesh used for collision detection.
Definition: DeformableCollisionRepresentation.h:95
A collision representation that can be attached to a deformable, when this contains a mesh with the s...
Definition: DeformableCollisionRepresentation.h:47
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
std::shared_ptr< SurgSim::Math::MeshShape > m_shape
Shape used for collision detection.
Definition: DeformableCollisionRepresentation.h:92
Wrapper class to use for the collision operation, handles its enclosed shaped and a possible local to...
Definition: Representation.h:52
std::weak_ptr< SurgSim::Physics::DeformableRepresentation > m_deformable
Reference to the deformable driving changes to this mesh.
Definition: DeformableCollisionRepresentation.h:98