opensurgsim
ShapeCollisionRepresentation.h
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_COLLISION_SHAPECOLLISIONREPRESENTATION_H
17 #define SURGSIM_COLLISION_SHAPECOLLISIONREPRESENTATION_H
18 
19 #include "SurgSim/Collision/Representation.h"
20 #include "SurgSim/Framework/Macros.h"
21 #include "SurgSim/Framework/ObjectFactory.h"
22 
23 namespace SurgSim
24 {
25 namespace Math
26 {
27 class Shape;
28 }
29 
30 namespace Collision
31 {
32 SURGSIM_STATIC_REGISTRATION(ShapeCollisionRepresentation);
33 
39 {
40 public:
42  explicit ShapeCollisionRepresentation(const std::string& name);
43 
46 
48 
49  int getShapeType() const override;
50 
51  void setLocalPose(const SurgSim::Math::RigidTransform3d& pose) override;
52 
53  // Set the shape to be used in this representation
54  // \param shape Shape to be used in this representation.
55  void setShape(const std::shared_ptr<SurgSim::Math::Shape>& shape);
56 
57  std::shared_ptr<Math::Shape> getShape() const override;
58  void updateCcdData(double timeOfImpact) override;
59 
60 protected:
61  bool doInitialize() override;
62 
63 private:
64  // Shape used by this representation
65  std::shared_ptr<SurgSim::Math::Shape> m_shape;
66 };
67 
68 }; // namespace Collision
69 }; // namespace SurgSim
70 
71 #endif // SURGSIM_COLLISION_SHAPECOLLISIONREPRESENTATION_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
The type of collision detection.
Definition: Representation.h:60
Use a Shape as a Collision Representation, any SurgSim::Physics::Representation can be used as a back...
Definition: ShapeCollisionRepresentation.h:38