ContactConstraintData.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_CONTACTCONSTRAINTDATA_H
#define SURGSIM_PHYSICS_CONTACTCONSTRAINTDATA_H
#include "SurgSim/Collision/CollisionPair.h"
#include "SurgSim/Physics/ConstraintData.h"
#include "SurgSim/Math/Vector.h"
namespace SurgSim
{
namespace Physics
{
class ContactConstraintData : public ConstraintData
{
public:
ContactConstraintData() :
ConstraintData(),
m_distance(0.0)
{
m_normal.setZero();
}
virtual ~ContactConstraintData()
{
}
void setPlaneEquation(const SurgSim::Math::Vector3d& n, double d)
{
m_normal = n;
m_distance = d;
}
const SurgSim::Math::Vector3d& getNormal() const
{
return m_normal;
}
double getDistance() const
{
return m_distance;
}
double getContactTime() const
{
return m_contact->time;
}
std::shared_ptr<Collision::Contact> getContact()
{
return m_contact;
}
void setContact(const std::shared_ptr<Collision::Contact>& contacts)
{
m_contact = contacts;
}
private:
SurgSim::Math::Vector3d m_normal;
double m_distance;
std::shared_ptr<Collision::Contact> m_contact;
};
}; // namespace Physics
}; // namespace SurgSim
#endif // SURGSIM_PHYSICS_CONTACTCONSTRAINTDATA_H
SurgSim::Physics::ContactConstraintData::getContact
std::shared_ptr< Collision::Contact > getContact()
Definition: ContactConstraintData.h:78
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Physics::ContactConstraintData::setContact
void setContact(const std::shared_ptr< Collision::Contact > &contacts)
Definition: ContactConstraintData.h:84
SurgSim::Physics::ContactConstraintData::getContactTime
double getContactTime() const
Gets the time of contact for the collision.
Definition: ContactConstraintData.h:72
SurgSim::Physics::ConstraintData
Base class for all CosntraintData Derived classes should be specific to a given constraint.
Definition: ConstraintData.h:27
SurgSim::Physics::ContactConstraintData::getDistance
double getDistance() const
Gets the plane distance to the origin.
Definition: ContactConstraintData.h:65
SurgSim::Physics::ContactConstraintData::setPlaneEquation
void setPlaneEquation(const SurgSim::Math::Vector3d &n, double d)
Sets the plane equation of the frictionless contact.
Definition: ContactConstraintData.h:50
SurgSim::Physics::ContactConstraintData::m_contact
std::shared_ptr< Collision::Contact > m_contact
The contact that uses this constraint data.
Definition: ContactConstraintData.h:97
SurgSim::Physics::ContactConstraintData::getNormal
const SurgSim::Math::Vector3d & getNormal() const
Gets the plane normal vector.
Definition: ContactConstraintData.h:58
Vector.h
Definitions of small fixed-size vector types.
SurgSim::Physics::ContactConstraintData::m_distance
double m_distance
Plane equation distance to origin.
Definition: ContactConstraintData.h:94
SurgSim::Physics::ContactConstraintData
Class for Frictionless contact (only needs a plane equation)
Definition: ContactConstraintData.h:30
ConstraintData.h
SurgSim::Physics::ContactConstraintData::m_normal
SurgSim::Math::Vector3d m_normal
Plane equation normal vector (normalized vector)
Definition: ContactConstraintData.h:91
SurgSim::Physics::ContactConstraintData::ContactConstraintData
ContactConstraintData()
Default constructor.
Definition: ContactConstraintData.h:34
SurgSim::Math::Vector3d
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
CollisionPair.h
SurgSim::Physics::ContactConstraintData::~ContactConstraintData
virtual ~ContactConstraintData()
Destructor.
Definition: ContactConstraintData.h:42