SegmentSegmentCcdIntervalCheck.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2015, 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_COLLISION_SEGMENTSEGMENTCCDINTERVALCHECK_H
#define SURGSIM_COLLISION_SEGMENTSEGMENTCCDINTERVALCHECK_H
#include "SurgSim/Math/LinearMotionArithmetic.h"
#include "SurgSim/Math/PolynomialValues.h"
namespace SurgSim
{
namespace Collision
{
class SegmentSegmentCcdIntervalCheck
{
public:
enum IntervalCheckResults
{
IntervalCheckPossibleCollision,
IntervalCheckNoCollisionVolume,
IntervalCheckNoCollisionEndpoints
};
SegmentSegmentCcdIntervalCheck(const std::array<Math::Vector3d, 2>& pT0,
const std::array<Math::Vector3d, 2>& pT1,
const std::array<Math::Vector3d, 2>& qT0,
const std::array<Math::Vector3d, 2>& qT1,
double thicknessP, double thicknessQ,
double timePrecisionEpsilon, double distanceEpsilon);
const Math::LinearMotionND<double, 3>& motionP1() const;
const Math::LinearMotionND<double, 3>& motionP2() const;
const Math::LinearMotionND<double, 3>& motionQ1() const;
const Math::LinearMotionND<double, 3>& motionQ2() const;
Math::Vector3d p1T0() const;
Math::Vector3d p1T1() const;
Math::Vector3d p2T0() const;
Math::Vector3d p2T1() const;
Math::Vector3d q1T0() const;
Math::Vector3d q1T1() const;
Math::Vector3d q2T0() const;
Math::Vector3d q2T1() const;
const Math::PolynomialValues<double, 3>& P1Q1_P1P2_Q1Q2() const;
const Math::PolynomialValues<double, 2>& P1P2_P1Q1() const;
const Math::PolynomialValues<double, 2>& Q1Q2_P1Q1() const;
const Math::PolynomialValues<double, 2>& P1P2_Q1Q2() const;
const Math::PolynomialValues<double, 2>& P1P2_sq() const;
const Math::PolynomialValues<double, 2>& Q1Q2_sq() const;
Math::Interval<double> crossValueOnInterval(const Math::Interval<double>& range) const;
double thicknessP() const;
double thicknessQ() const;
void setTimePrecisionEpsilon(double epsilon);
void setDistanceEpsilon(double epsilon);
void setTripleProductEpsilon(double epsilon);
void setMuNuEpsilon(double epsilon);
double timePrecisionEpsilon() const;
double distanceEpsilon() const;
double tripleProductEpsilon() const;
double muNuEpsilon() const;
IntervalCheckResults possibleCollisionTestNoThickness(const Math::Interval<double>& range) const;
IntervalCheckResults possibleCollisionTestWithThickness(const Math::Interval<double>& range) const;
private:
SegmentSegmentCcdIntervalCheck(const SegmentSegmentCcdIntervalCheck&);
SegmentSegmentCcdIntervalCheck& operator=(const SegmentSegmentCcdIntervalCheck&);
Math::LinearMotionND<double, 3> m_motionP1;
Math::LinearMotionND<double, 3> m_motionP2;
Math::LinearMotionND<double, 3> m_motionQ1;
Math::LinearMotionND<double, 3> m_motionQ2;
Math::LinearMotionND<double, 3> m_relativeP1Q1;
Math::LinearMotionND<double, 3> m_relativeQ1Q2;
Math::LinearMotionND<double, 3> m_relativeP1P2;
Math::PolynomialValues<double, 3> m_P1Q1_P1P2_Q1Q2;
Math::PolynomialValues<double, 2> m_P1P2_P1Q1;
Math::PolynomialValues<double, 2> m_Q1Q2_P1Q1;
Math::PolynomialValues<double, 2> m_P1P2_Q1Q2;
Math::PolynomialValues<double, 2> m_P1P2_sq;
Math::PolynomialValues<double, 2> m_Q1Q2_sq;
Math::PolynomialValues<double, 2> m_P1P2xQ1Q2_x;
Math::PolynomialValues<double, 2> m_P1P2xQ1Q2_y;
Math::PolynomialValues<double, 2> m_P1P2xQ1Q2_z;
double m_thicknessP;
double m_thicknessQ;
double m_timePrecisionEpsilon;
double m_distanceEpsilon;
double m_volumeEpsilonTimes6;
double m_muNuEpsilon;
};
}; // namespace Collision
}; // namespace SurgSim
#endif // SURGSIM_COLLISION_SEGMENTSEGMENTCCDINTERVALCHECK_H
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_distanceEpsilon
double m_distanceEpsilon
Definition: SegmentSegmentCcdIntervalCheck.h:220
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::p1T0
Math::Vector3d p1T0() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:72
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::setDistanceEpsilon
void setDistanceEpsilon(double epsilon)
Definition: SegmentSegmentCcdIntervalCheck.cpp:166
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2_sq
Math::PolynomialValues< double, 2 > m_P1P2_sq
Definition: SegmentSegmentCcdIntervalCheck.h:200
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_relativeP1Q1
Math::LinearMotionND< double, 3 > m_relativeP1Q1
Definition: SegmentSegmentCcdIntervalCheck.h:179
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::thicknessP
double thicknessP() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:152
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::thicknessQ
double thicknessQ() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:156
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_volumeEpsilonTimes6
double m_volumeEpsilonTimes6
Definition: SegmentSegmentCcdIntervalCheck.h:221
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::IntervalCheckNoCollisionEndpoints
Definition: SegmentSegmentCcdIntervalCheck.h:51
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2_P1Q1
Math::PolynomialValues< double, 2 > m_P1P2_P1Q1
Definition: SegmentSegmentCcdIntervalCheck.h:192
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::IntervalCheckPossibleCollision
Definition: SegmentSegmentCcdIntervalCheck.h:49
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_motionQ2
Math::LinearMotionND< double, 3 > m_motionQ2
Definition: SegmentSegmentCcdIntervalCheck.h:173
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::q2T1
Math::Vector3d q2T1() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:107
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::setTimePrecisionEpsilon
void setTimePrecisionEpsilon(double epsilon)
Definition: SegmentSegmentCcdIntervalCheck.cpp:161
SurgSim::Math::PolynomialValues< double, 3 >
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_motionP2
Math::LinearMotionND< double, 3 > m_motionP2
Definition: SegmentSegmentCcdIntervalCheck.h:171
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_motionQ1
Math::LinearMotionND< double, 3 > m_motionQ1
Definition: SegmentSegmentCcdIntervalCheck.h:172
PolynomialValues.h
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::motionQ1
const Math::LinearMotionND< double, 3 > & motionQ1() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:62
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::IntervalCheckNoCollisionVolume
Definition: SegmentSegmentCcdIntervalCheck.h:50
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::operator=
SegmentSegmentCcdIntervalCheck & operator=(const SegmentSegmentCcdIntervalCheck &)
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::Q1Q2_P1Q1
const Math::PolynomialValues< double, 2 > & Q1Q2_P1Q1() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:122
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_relativeP1P2
Math::LinearMotionND< double, 3 > m_relativeP1P2
Definition: SegmentSegmentCcdIntervalCheck.h:181
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::q1T0
Math::Vector3d q1T0() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:92
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_muNuEpsilon
double m_muNuEpsilon
Definition: SegmentSegmentCcdIntervalCheck.h:222
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::q1T1
Math::Vector3d q1T1() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:97
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::possibleCollisionTestWithThickness
IntervalCheckResults possibleCollisionTestWithThickness(const Math::Interval< double > &range) const
Check if a collision is possible within a specified time interval assuming segments with fixed radius...
Definition: SegmentSegmentCcdIntervalCheck.cpp:247
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::setMuNuEpsilon
void setMuNuEpsilon(double epsilon)
Definition: SegmentSegmentCcdIntervalCheck.cpp:176
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::p1T1
Math::Vector3d p1T1() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:77
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::motionP1
const Math::LinearMotionND< double, 3 > & motionP1() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:52
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::setTripleProductEpsilon
void setTripleProductEpsilon(double epsilon)
Definition: SegmentSegmentCcdIntervalCheck.cpp:171
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2_Q1Q2
Math::PolynomialValues< double, 2 > m_P1P2_Q1Q2
Definition: SegmentSegmentCcdIntervalCheck.h:194
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2xQ1Q2_x
Math::PolynomialValues< double, 2 > m_P1P2xQ1Q2_x
Definition: SegmentSegmentCcdIntervalCheck.h:206
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::p2T0
Math::Vector3d p2T0() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:82
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::Q1Q2_sq
const Math::PolynomialValues< double, 2 > & Q1Q2_sq() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:137
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_thicknessQ
double m_thicknessQ
Definition: SegmentSegmentCcdIntervalCheck.h:214
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::motionP2
const Math::LinearMotionND< double, 3 > & motionP2() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:57
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::tripleProductEpsilon
double tripleProductEpsilon() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:191
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::P1Q1_P1P2_Q1Q2
const Math::PolynomialValues< double, 3 > & P1Q1_P1P2_Q1Q2() const
Triple product value.
Definition: SegmentSegmentCcdIntervalCheck.cpp:112
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::P1P2_P1Q1
const Math::PolynomialValues< double, 2 > & P1P2_P1Q1() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:117
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::P1P2_sq
const Math::PolynomialValues< double, 2 > & P1P2_sq() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:132
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_Q1Q2_sq
Math::PolynomialValues< double, 2 > m_Q1Q2_sq
Definition: SegmentSegmentCcdIntervalCheck.h:201
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::P1P2_Q1Q2
const Math::PolynomialValues< double, 2 > & P1P2_Q1Q2() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:127
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_Q1Q2_P1Q1
Math::PolynomialValues< double, 2 > m_Q1Q2_P1Q1
Definition: SegmentSegmentCcdIntervalCheck.h:193
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1Q1_P1P2_Q1Q2
Math::PolynomialValues< double, 3 > m_P1Q1_P1P2_Q1Q2
The triple product of (Q1(t) - P1(t)) X (P2(t) - P1(t)) X (Q2(t) - Q1(t)) as a 3rd degree polynomial ...
Definition: SegmentSegmentCcdIntervalCheck.h:187
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_relativeQ1Q2
Math::LinearMotionND< double, 3 > m_relativeQ1Q2
Definition: SegmentSegmentCcdIntervalCheck.h:180
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::q2T0
Math::Vector3d q2T0() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:102
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_thicknessP
double m_thicknessP
Definition: SegmentSegmentCcdIntervalCheck.h:213
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::timePrecisionEpsilon
double timePrecisionEpsilon() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:181
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::p2T1
Math::Vector3d p2T1() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:87
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2xQ1Q2_y
Math::PolynomialValues< double, 2 > m_P1P2xQ1Q2_y
Definition: SegmentSegmentCcdIntervalCheck.h:207
SurgSim::Math::Interval
Interval defines the concept of a mathematical interval and provides operations on it including arith...
Definition: IntervalArithmetic.h:34
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_timePrecisionEpsilon
double m_timePrecisionEpsilon
Definition: SegmentSegmentCcdIntervalCheck.h:219
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_motionP1
Math::LinearMotionND< double, 3 > m_motionP1
Definition: SegmentSegmentCcdIntervalCheck.h:170
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::distanceEpsilon
double distanceEpsilon() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:186
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::crossValueOnInterval
Math::Interval< double > crossValueOnInterval(const Math::Interval< double > &range) const
Definition: SegmentSegmentCcdIntervalCheck.cpp:142
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::IntervalCheckResults
IntervalCheckResults
Enum Possible interval check return values.
Definition: SegmentSegmentCcdIntervalCheck.h:47
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::m_P1P2xQ1Q2_z
Math::PolynomialValues< double, 2 > m_P1P2xQ1Q2_z
Definition: SegmentSegmentCcdIntervalCheck.h:208
SurgSim::Math::LinearMotionND< double, 3 >
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::SegmentSegmentCcdIntervalCheck
SegmentSegmentCcdIntervalCheck(const std::array< Math::Vector3d, 2 > &pT0, const std::array< Math::Vector3d, 2 > &pT1, const std::array< Math::Vector3d, 2 > &qT0, const std::array< Math::Vector3d, 2 > &qT1, double thicknessP, double thicknessQ, double timePrecisionEpsilon, double distanceEpsilon)
Constructor.
Definition: SegmentSegmentCcdIntervalCheck.cpp:25
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::muNuEpsilon
double muNuEpsilon() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:196
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::possibleCollisionTestNoThickness
IntervalCheckResults possibleCollisionTestNoThickness(const Math::Interval< double > &range) const
Check if a collision is possible within a specified time interval assuming ideal (0 thickness) segmen...
Definition: SegmentSegmentCcdIntervalCheck.cpp:201
LinearMotionArithmetic.h
SurgSim::Math::Vector3d
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57
SurgSim::Collision::SegmentSegmentCcdIntervalCheck
SegmentSegmentCcdIntervalCheck uses the Interval classes including the LinearMotion and Polynomial fa...
Definition: SegmentSegmentCcdIntervalCheck.h:37
SurgSim::Collision::SegmentSegmentCcdIntervalCheck::motionQ2
const Math::LinearMotionND< double, 3 > & motionQ2() const
Definition: SegmentSegmentCcdIntervalCheck.cpp:67