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  int getShapeType() const override;
48 
49  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 
55  const std::shared_ptr<SurgSim::Math::Shape> getShape() const override;
56 
57 protected:
58  bool doInitialize() override;
59 
60 private:
61  // Shape used by this representation
62  std::shared_ptr<SurgSim::Math::Shape> m_shape;
63 };
64 
65 }; // namespace Collision
66 }; // namespace SurgSim
67 
68 #endif // SURGSIM_COLLISION_SHAPECOLLISIONREPRESENTATION_H
SurgSim::Collision::ShapeCollisionRepresentation::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Collision::ShapeCollisionRepresentation)
Macros.h
SurgSim::Collision::ShapeCollisionRepresentation
Use a Shape as a Collision Representation, any SurgSim::Physics::Representation can be used as a back...
Definition: ShapeCollisionRepresentation.h:37
SurgSim::Math::RigidTransform3d
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
ObjectFactory.h
SurgSim
Definition: CompoundShapeToGraphics.cpp:30
SurgSim::Collision::ShapeCollisionRepresentation::getShape
const std::shared_ptr< SurgSim::Math::Shape > getShape() const override
Get the shape.
Definition: ShapeCollisionRepresentation.cpp:60
SurgSim::Collision::Representation
The type of collision detection.
Definition: Representation.h:61
SurgSim::Collision::ShapeCollisionRepresentation::doInitialize
bool doInitialize() override
Interface to be implemented by derived classes.
Definition: ShapeCollisionRepresentation.cpp:65
SurgSim::Collision::ShapeCollisionRepresentation::m_shape
std::shared_ptr< SurgSim::Math::Shape > m_shape
Definition: ShapeCollisionRepresentation.h:62
SurgSim::Collision::ShapeCollisionRepresentation::~ShapeCollisionRepresentation
virtual ~ShapeCollisionRepresentation()
Destructor.
Definition: ShapeCollisionRepresentation.cpp:37
SurgSim::Collision::ShapeCollisionRepresentation::setLocalPose
void setLocalPose(const SurgSim::Math::RigidTransform3d &pose) override
Set the pose of the representation with respect to the Scene Element.
Definition: ShapeCollisionRepresentation.cpp:47
Representation.h
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
SurgSim::Collision::ShapeCollisionRepresentation::setShape
void setShape(const std::shared_ptr< SurgSim::Math::Shape > &shape)
Definition: ShapeCollisionRepresentation.cpp:53
SurgSim::Collision::ShapeCollisionRepresentation::getShapeType
int getShapeType() const override
Get the shape type id.
Definition: ShapeCollisionRepresentation.cpp:41
SurgSim::Collision::ShapeCollisionRepresentation::ShapeCollisionRepresentation
ShapeCollisionRepresentation(const std::string &name)
Constructor.
Definition: ShapeCollisionRepresentation.cpp:30