ShapeCollisionRepresentation.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_COLLISION_SHAPECOLLISIONREPRESENTATION_H
17 #define SURGSIM_COLLISION_SHAPECOLLISIONREPRESENTATION_H
18 
22 
23 namespace SurgSim
24 {
25 namespace Math
26 {
27 class Shape;
28 }
29 
30 namespace Collision
31 {
32 SURGSIM_STATIC_REGISTRATION(ShapeCollisionRepresentation);
33 
37 {
38 public:
40  explicit ShapeCollisionRepresentation(const std::string& name);
41 
44 
46 
47  virtual int getShapeType() const override;
48 
49  virtual void setLocalPose(const SurgSim::Math::RigidTransform3d& pose) override;
50 
51  // Set the shape to be used in this representation
52  // \param shape Shape to be used in this representation.
53  void setShape(const std::shared_ptr<SurgSim::Math::Shape>& shape);
54  virtual const std::shared_ptr<SurgSim::Math::Shape> getShape() const override;
55 
56  virtual void update(const double& dt) override;
57  virtual bool doInitialize() override;
58 
59 private:
60  // Shape used by this representation
61  std::shared_ptr<SurgSim::Math::Shape> m_shape;
62 };
63 
64 }; // namespace Collision
65 }; // namespace SurgSim
66 
67 #endif // SURGSIM_COLLISION_SHAPECOLLISIONREPRESENTATION_H
Definition: DriveElementFromInputBehavior.cpp:27
virtual const std::shared_ptr< SurgSim::Math::Shape > getShape() const override
Get the shape.
Definition: ShapeCollisionRepresentation.cpp:59
SURGSIM_STATIC_REGISTRATION(ShapeCollisionRepresentation)
virtual void update(const double &dt) override
Update the representation.
Definition: ShapeCollisionRepresentation.cpp:64
SURGSIM_CLASSNAME(SurgSim::Collision::ShapeCollisionRepresentation)
virtual int getShapeType() const override
Get the shape type id.
Definition: ShapeCollisionRepresentation.cpp:40
ShapeCollisionRepresentation(const std::string &name)
Constructor.
Definition: ShapeCollisionRepresentation.cpp:29
virtual ~ShapeCollisionRepresentation()
Destructor.
Definition: ShapeCollisionRepresentation.cpp:36
std::shared_ptr< SurgSim::Math::Shape > m_shape
Definition: ShapeCollisionRepresentation.h:61
virtual bool doInitialize() override
Interface to be implemented by derived classes.
Definition: ShapeCollisionRepresentation.cpp:75
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
Wrapper class to use for the collision operation, handles its enclosed shaped and a possible local to...
Definition: Representation.h:52
Use a Shape as a Collision Representation, any SurgSim::Physics::Representation can be used as a back...
Definition: ShapeCollisionRepresentation.h:36
void setShape(const std::shared_ptr< SurgSim::Math::Shape > &shape)
Definition: ShapeCollisionRepresentation.cpp:52
virtual void setLocalPose(const SurgSim::Math::RigidTransform3d &pose) override
Set the pose of the representation with respect to the Scene Element.
Definition: ShapeCollisionRepresentation.cpp:46