RigidCollisionRepresentation.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_RIGIDCOLLISIONREPRESENTATION_H
17 #define SURGSIM_PHYSICS_RIGIDCOLLISIONREPRESENTATION_H
18 
19 #include <memory>
20 
23 
24 namespace SurgSim
25 {
26 namespace Physics
27 {
28 class RigidRepresentationBase;
29 
30 SURGSIM_STATIC_REGISTRATION(RigidCollisionRepresentation);
31 
36 {
37 public:
40  explicit RigidCollisionRepresentation(const std::string& name);
41 
44 
46 
47  virtual void update(const double& dt) override;
48 
51  virtual SurgSim::Math::RigidTransform3d getPose() const override;
52 
55  virtual int getShapeType() const override;
56 
59  virtual const std::shared_ptr<SurgSim::Math::Shape> getShape() const override;
60 
65  void setShape(std::shared_ptr<SurgSim::Math::Shape> shape);
66 
69  void setRigidRepresentation(std::shared_ptr<SurgSim::Physics::RigidRepresentationBase> representation);
70 
73  std::shared_ptr<SurgSim::Physics::RigidRepresentationBase> getRigidRepresentation();
74 
75 private:
76  std::weak_ptr<SurgSim::Physics::RigidRepresentationBase> m_physicsRepresentation;
77  std::shared_ptr<SurgSim::Math::Shape> m_shape;
78 };
79 
80 }; // namespace Collision
81 }; // namespace SurgSim
82 
83 #endif // SURGSIM_PHYSICS_RIGIDCOLLISIONREPRESENTATION_H
Definition: DriveElementFromInputBehavior.cpp:27
std::shared_ptr< SurgSim::Math::Shape > m_shape
Definition: RigidCollisionRepresentation.h:77
void setRigidRepresentation(std::shared_ptr< SurgSim::Physics::RigidRepresentationBase > representation)
Set rigid representation.
Definition: RigidCollisionRepresentation.cpp:51
void setShape(std::shared_ptr< SurgSim::Math::Shape > shape)
Set the shape The default is to use the shape of the Rigid Representation, this will override that sh...
Definition: RigidCollisionRepresentation.cpp:82
virtual SurgSim::Math::RigidTransform3d getPose() const override
Get the pose of the representation.
Definition: RigidCollisionRepresentation.cpp:87
std::shared_ptr< SurgSim::Physics::RigidRepresentationBase > getRigidRepresentation()
Gets physics representation.
Definition: RigidCollisionRepresentation.cpp:57
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
virtual void update(const double &dt) override
Update the representation.
Definition: RigidCollisionRepresentation.cpp:42
std::weak_ptr< SurgSim::Physics::RigidRepresentationBase > m_physicsRepresentation
Definition: RigidCollisionRepresentation.h:76
Collision Representation class that wraps a RigidRepresentation, this can be used to strictly tie the...
Definition: RigidCollisionRepresentation.h:35
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
virtual const std::shared_ptr< SurgSim::Math::Shape > getShape() const override
Get the shape.
Definition: RigidCollisionRepresentation.cpp:67
virtual int getShapeType() const override
Get the shape type id.
Definition: RigidCollisionRepresentation.cpp:62
SURGSIM_CLASSNAME(SurgSim::Physics::RigidCollisionRepresentation)
Wrapper class to use for the collision operation, handles its enclosed shaped and a possible local to...
Definition: Representation.h:52
RigidCollisionRepresentation(const std::string &name)
Constructor.
Definition: RigidCollisionRepresentation.cpp:31
virtual ~RigidCollisionRepresentation()
Destructor.
Definition: RigidCollisionRepresentation.cpp:38
SURGSIM_STATIC_REGISTRATION(DeformableCollisionRepresentation)