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 
50 
53  int getShapeType() const override;
54 
57  const std::shared_ptr<SurgSim::Math::Shape> getShape() const override;
58 
63  void setShape(std::shared_ptr<SurgSim::Math::Shape> shape);
64 
67  void setRigidRepresentation(std::shared_ptr<SurgSim::Physics::RigidRepresentationBase> representation);
68 
71  std::shared_ptr<SurgSim::Physics::RigidRepresentationBase> getRigidRepresentation();
72 
73  void updateShapeData() override;
74  void updateDcdData() override;
75  void updateCcdData(double timeOfImpact) override;
76 
77 private:
78  std::weak_ptr<SurgSim::Physics::RigidRepresentationBase> m_physicsRepresentation;
79  std::shared_ptr<SurgSim::Math::Shape> m_shape;
80 };
81 
82 }; // namespace Collision
83 }; // namespace SurgSim
84 
85 #endif // SURGSIM_PHYSICS_RIGIDCOLLISIONREPRESENTATION_H
SurgSim::Physics::RigidCollisionRepresentation::m_physicsRepresentation
std::weak_ptr< SurgSim::Physics::RigidRepresentationBase > m_physicsRepresentation
Definition: RigidCollisionRepresentation.h:78
SurgSim::Physics::RigidCollisionRepresentation
Collision Representation class that wraps a RigidRepresentation, this can be used to strictly tie the...
Definition: RigidCollisionRepresentation.h:35
SurgSim::Physics::RigidCollisionRepresentation::setRigidRepresentation
void setRigidRepresentation(std::shared_ptr< SurgSim::Physics::RigidRepresentationBase > representation)
Set rigid representation.
Definition: RigidCollisionRepresentation.cpp:44
SurgSim::Physics::RigidCollisionRepresentation::getShape
const std::shared_ptr< SurgSim::Math::Shape > getShape() const override
Get the shape.
Definition: RigidCollisionRepresentation.cpp:60
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:29
SurgSim::Physics::RigidCollisionRepresentation::updateDcdData
void updateDcdData() override
Update the data (the shape) in preparation for a DCD contact calculation.
Definition: RigidCollisionRepresentation.cpp:96
SurgSim::Collision::Representation
The type of collision detection.
Definition: Representation.h:60
SurgSim::Physics::RigidCollisionRepresentation::~RigidCollisionRepresentation
virtual ~RigidCollisionRepresentation()
Destructor.
Definition: RigidCollisionRepresentation.cpp:40
SurgSim::Physics::RigidCollisionRepresentation::m_shape
std::shared_ptr< SurgSim::Math::Shape > m_shape
Definition: RigidCollisionRepresentation.h:79
SurgSim::Physics::RigidCollisionRepresentation::getShapeType
int getShapeType() const override
Get the shape type id.
Definition: RigidCollisionRepresentation.cpp:55
SurgSim::Physics::RigidCollisionRepresentation::getPose
SurgSim::Math::RigidTransform3d getPose() const override
Get the pose of the representation.
Definition: RigidCollisionRepresentation.cpp:80
SurgSim::Physics::RigidCollisionRepresentation::setShape
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:75
SurgSim::Physics::RigidCollisionRepresentation::updateCcdData
void updateCcdData(double timeOfImpact) override
Update the data (the motionShape) in preparation for a CCD contact calcul ation.
Definition: RigidCollisionRepresentation.cpp:103
SurgSim::Physics::RigidCollisionRepresentation::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Physics::RigidCollisionRepresentation)
SurgSim::Physics::RigidCollisionRepresentation::RigidCollisionRepresentation
RigidCollisionRepresentation(const std::string &name)
Constructor.
Definition: RigidCollisionRepresentation.cpp:33
SurgSim::Physics::RigidCollisionRepresentation::updateShapeData
void updateShapeData() override
Update the basic Shape's state from the physics state, so that the bounding box can correctly be dete...
Definition: RigidCollisionRepresentation.cpp:89
Representation.h
string
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
SurgSim::Physics::RigidCollisionRepresentation::getRigidRepresentation
std::shared_ptr< SurgSim::Physics::RigidRepresentationBase > getRigidRepresentation()
Gets physics representation.
Definition: RigidCollisionRepresentation.cpp:50