 |
AGXDynamics
2.35.0.3
|
Go to the documentation of this file.
17 #ifndef AGXCOLLIDE_LINESEGMENTINTERSECTIONFINDER_H
18 #define AGXCOLLIDE_LINESEGMENTINTERSECTIONFINDER_H
31 namespace agxGeometryQueries {
98 bool isDegeneratedToPoint()
const;
178 bool isDegeneratedToPoint()
const;
181 bool isDegeneratedToLine()
const;
184 agx::Vec3 computeSweepDirectionPoint0()
const;
187 agx::Vec3 computeSweepDirectionPoint1()
const;
216 static bool calculateLineSegmentCollision(
220 agx::Interval& lineParameters0,
221 agx::Interval& lineParameters1,
234 namespace agxGeometryQueries {
250 if (isDegeneratedToPoint())
253 return (m_dir * (point - m_point)) / m_dirLength2;
259 const agx::Vec3 projection = m_point + m_dir * projectPoint(point);
272 return agx::Interval(projectPoint(segment.
point0()), projectPoint(segment.
point1()),
false);
284 return m_point + m_dir * lineParameter;
302 m_dir(point1 - point0), m_dirLength2(m_dir * m_dir)
314 if (isDegeneratedToPoint())
317 return (m_dir * (point - m_point0)) / m_dirLength2;
323 const agx::Real projection = projectPointToInfiniteLine(point);
324 if (projection < 0 || projection * projection > m_dirLength2)
326 const agx::Vec3 projectionPoint = m_point0 + m_dir * projection;
327 const agx::Vec3 dist = point - projectionPoint;
328 return dist.
length2() < epsilon * epsilon;
370 return m_point0 + m_dir * lineParameter;
380 :m_segment0(start), m_segment1(
end)
387 const agx::Vec3 point = m_segment0.evaluateAt(lineParameter) * (
agx::Real(1.0) - time) + m_segment1.evaluateAt(lineParameter) * time;
394 const LineSegment segment(m_segment0.point0() * (
agx::Real(1.0) - time) + m_segment1.point0() * time,
395 m_segment0.point1() * (
agx::Real(1.0) - time) + m_segment1.point1() * time);
465 #endif // AGXCOLLIDE_LINESEGMENTINTERSECTIONFINDER_H
bool isDegeneratedToPoint() const
Is the swept line segment degenerated to a point?
const agx::Vec3 & dir() const
Gets the direction; not necessarily normalized.
const AGXCORE_EXPORT Real RealEpsilon
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
agx::Vec3 evaluateAt(const agx::Real time, const agx::Real lineParameter) const
Evaluates the swept line at a given time and line parameter and returns a point.
LineSegment & segment1()
Gets the swept line segment's second line segment, i.e. at t=1.
A line segment. Note that the direction does not have to be normalized.
agx::Vec3 computeSweepDirectionPoint1() const
Returns the non-normalized sweep direction of point1 over time.
AGXPHYSICS_EXPORT agx::Bool equivalent(const agx::AddedMassInteraction::Matrix6x6 &lhs, const agx::AddedMassInteraction::Matrix6x6 &rhs, agx::Real eps=agx::RealEpsilon)
A line segment that is swept in time from t=0 to t=1.
bool containsPoint(const agx::Vec3 &point, const agx::Real epsilon=agx::RealEpsilon) const
Does the line contain the point, given an epsilon threshold?
bool isDegeneratedToLine() const
Is the swept line segment degenerated to a line?
const agx::Vec3 & point1() const
Gets the line segment's second point.
const agx::Vec3 & point() const
Gets the starting point of the line.
class AGXPHYSICS_EXPORT LineSegment
bool isDegeneratedToPoint() const
Is the line segment degenerated to a point?
agx::Real projectPointToInfiniteLine(const agx::Vec3 &point) const
Computes the scalar value of the projection of a point along the segment's line.
const agx::Vec3 & dir() const
Gets the direction; not necessarily normalized.
bool AGXPHYSICS_EXPORT pointsAreIdentical(const agx::Vec3 &point0, const agx::Vec3 &point1)
Tests if two points are identical given agxGeometryQueries::geometricEpsilon.
bool containsPoint(const agx::Vec3 &point, const agx::Real epsilon=agx::RealEpsilon) const
Does the line segment contain the point, given an epsilon threshold?
agxGeometryQueries::Line getLine() const
Gets the line segment's line.
Line(const agx::Vec3 &point, const agx::Vec3 &dir)
Note that the direction does not have to be normalized.
#define AGXPHYSICS_EXPORT
AGXPHYSICS_EXPORT agx::Bool equalsZero(const agx::AddedMassInteraction::Matrix6x6 &matrix, agx::Real eps=agx::RealEpsilon)
LineSegment computeSweepSegmentPoint1() const
Returns the line segment point1 over time.
An infinite line, defined by a starting point and a (not necessarily normalized) direction.
SweptLineSegment()
Creates a SweptLineSegment, with both line segments degenaring to points at the origin.
agx::Interval projectLineSegment(const LineSegment &segment) const
Computes the interval of the projection of a line segment onto this line.
agx::Real projectPoint(const agx::Vec3 &point) const
Computes the scalar value of the projection of a point along the line.
agx::Vec3 evaluateAt(const agx::Real lineParameter) const
Evaluates the line equation at the parameter.
LineSegment computeSweepSegmentPoint0() const
Returns the line segment point0 over time.
agx::Vec3 evaluateAt(const agx::Real lineParameter) const
Note that the line dir does not have to be normalized.
agx::Real dirLength2() const
Gets the squared length of the line direction.
This namespace consists of a set of classes for handling geometric intersection tests including boole...
LineSegment()
Creates an empty line segment, with both end points at origin.
agx::Real dirLength2() const
Gets the squared length of the line direction.
const agx::Real geometricEpsilon
LineSegment & segment0()
Gets the swept line segment's first line segment, i.e. at t=0.
bool isDegeneratedToPoint() const
Is the line degenerated to a point?
const agx::Vec3 & point0() const
Gets the line segment's first point.
Real length2() const
Length squared of the vector = vec .
Templated stack array class.
agx::Vec3 computeSweepDirectionPoint0() const
Returns the non-normalized sweep direction of point0 over time.