RigidCollisionRepresentation.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_PHYSICS_RIGIDCOLLISIONREPRESENTATION_H
#define SURGSIM_PHYSICS_RIGIDCOLLISIONREPRESENTATION_H
#include <memory>
#include "SurgSim/Collision/Representation.h"
#include "SurgSim/Framework/ObjectFactory.h"
namespace SurgSim
{
namespace Physics
{
class RigidRepresentationBase;
SURGSIM_STATIC_REGISTRATION(RigidCollisionRepresentation);
class RigidCollisionRepresentation : public SurgSim::Collision::Representation
{
public:
explicit RigidCollisionRepresentation(const std::string& name);
virtual ~RigidCollisionRepresentation();
SURGSIM_CLASSNAME(SurgSim::Physics::RigidCollisionRepresentation);
SurgSim::Math::RigidTransform3d getPose() const override;
int getShapeType() const override;
const std::shared_ptr<SurgSim::Math::Shape> getShape() const override;
void setShape(std::shared_ptr<SurgSim::Math::Shape> shape);
void setRigidRepresentation(std::shared_ptr<SurgSim::Physics::RigidRepresentationBase> representation);
std::shared_ptr<SurgSim::Physics::RigidRepresentationBase> getRigidRepresentation();
void updateShapeData() override;
void updateDcdData() override;
void updateCcdData(double timeOfImpact) override;
private:
std::weak_ptr<SurgSim::Physics::RigidRepresentationBase> m_physicsRepresentation;
std::shared_ptr<SurgSim::Math::Shape> m_shape;
};
}; // namespace Collision
}; // namespace SurgSim
#endif // SURGSIM_PHYSICS_RIGIDCOLLISIONREPRESENTATION_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Physics::RigidCollisionRepresentation::m_shape
std::shared_ptr< SurgSim::Math::Shape > m_shape
Definition: RigidCollisionRepresentation.h:79
SurgSim::Physics::RigidCollisionRepresentation::setRigidRepresentation
void setRigidRepresentation(std::shared_ptr< SurgSim::Physics::RigidRepresentationBase > representation)
Set rigid representation.
Definition: RigidCollisionRepresentation.cpp:44
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::getPose
SurgSim::Math::RigidTransform3d getPose() const override
Get the pose of the representation.
Definition: RigidCollisionRepresentation.cpp:80
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
ObjectFactory.h
SurgSim::Physics::RigidCollisionRepresentation::updateDcdData
void updateDcdData() override
Update the data (the shape) in preparation for a DCD contact calculation.
Definition: RigidCollisionRepresentation.cpp:96
SurgSim::Physics::RigidCollisionRepresentation::getRigidRepresentation
std::shared_ptr< SurgSim::Physics::RigidRepresentationBase > getRigidRepresentation()
Gets physics representation.
Definition: RigidCollisionRepresentation.cpp:50
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
Representation.h
SurgSim::Math::RigidTransform3d
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
SurgSim::Physics::RigidCollisionRepresentation::getShape
const std::shared_ptr< SurgSim::Math::Shape > getShape() const override
Get the shape.
Definition: RigidCollisionRepresentation.cpp:60
SurgSim::Physics::RigidCollisionRepresentation::getShapeType
int getShapeType() const override
Get the shape type id.
Definition: RigidCollisionRepresentation.cpp:55
SurgSim::Physics::RigidCollisionRepresentation::SURGSIM_CLASSNAME
SURGSIM_CLASSNAME(SurgSim::Physics::RigidCollisionRepresentation)
SurgSim::Collision::Representation
The type of collision detection.
Definition: Representation.h:60
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&#39;s state from the physics state, so that the bounding box can correctly be dete...
Definition: RigidCollisionRepresentation.cpp:89
SurgSim::Physics::RigidCollisionRepresentation::~RigidCollisionRepresentation
virtual ~RigidCollisionRepresentation()
Destructor.
Definition: RigidCollisionRepresentation.cpp:40