17 #ifndef AGXCOLLIDE_LINESEGMENTINTERSECTIONFINDER_H 18 #define AGXCOLLIDE_LINESEGMENTINTERSECTIONFINDER_H 31 namespace agxGeometryQueries {
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 {
253 return (m_dir * (point - m_point)) / m_dirLength2;
284 return m_point + m_dir * lineParameter;
302 m_dir(point1 - point0), m_dirLength2(m_dir * m_dir)
317 return (m_dir * (point - m_point0)) / m_dirLength2;
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)
465 #endif // AGXCOLLIDE_LINESEGMENTINTERSECTIONFINDER_H bool containsPoint(const agx::Vec3 &point, const agx::Real epsilon=agx::RealEpsilon) const
Does the line segment contain the point, given an epsilon threshold?
LineSegment & segment1()
Gets the swept line segment's second line segment, i.e. at t=1.
bool AGXPHYSICS_EXPORT pointsAreIdentical(const agx::Vec3 &point0, const agx::Vec3 &point1)
Tests if two points are identical given agxGeometryQueries::geometricEpsilon.
bool isDegeneratedToPoint() const
Is the line degenerated to a point?
LineSegment computeSweepSegmentPoint1() const
Returns the line segment point1 over time.
const agx::Vec3 & point0() const
Gets the line segment's first point.
Real length2() const
Length squared of the vector = vec .
class AGXPHYSICS_EXPORT LineSegment
A line segment. Note that the direction does not have to be normalized.
AGXCORE_EXPORT const Real RealEpsilon
This namespace consists of a set of classes for handling geometric intersection tests including boole...
const agx::Vec3 & dir() const
Gets the direction; not necessarily normalized.
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.
#define AGXPHYSICS_EXPORT
Templated stack array class.
const agx::Vec3 & point1() const
Gets the line segment's second point.
LineSegment computeSweepSegmentPoint0() const
Returns the line segment point0 over time.
agx::Real dirLength2() const
Gets the squared length of the line direction.
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
Note that the line dir does not have to be normalized.
LineSegment()
Creates an empty line segment, with both end points at origin.
bool isDegeneratedToPoint() const
Is the swept line segment degenerated to a point?
agxGeometryQueries::Line getLine() const
Gets the line segment's line.
agx::Real projectPointToInfiniteLine(const agx::Vec3 &point) const
Computes the scalar value of the projection of a point along the segment's line.
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.
bool isDegeneratedToLine() const
Is the swept line segment degenerated to a line?
const agx::Vec3 & dir() const
Gets the direction; not necessarily normalized.
agx::Vec3 computeSweepDirectionPoint0() const
Returns the non-normalized sweep direction of point0 over time.
const agx::Vec3 & point() const
Gets the starting point of the line.
Line(const agx::Vec3 &point, const agx::Vec3 &dir)
Note that the direction does not have to be normalized.
agx::Vec3 evaluateAt(const agx::Real lineParameter) const
Evaluates the line equation at the parameter.
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)
bool containsPoint(const agx::Vec3 &point, const agx::Real epsilon=agx::RealEpsilon) const
Does the line contain the point, given an epsilon threshold?
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
agx::Real dirLength2() const
Gets the squared length of the line direction.
AGXPHYSICS_EXPORT agx::Bool equalsZero(const agx::AddedMassInteraction::Matrix6x6 &matrix, agx::Real eps=agx::RealEpsilon)
A line segment that is swept in time from t=0 to t=1.
bool isDegeneratedToPoint() const
Is the line segment degenerated to a point?
const agx::Real geometricEpsilon
agx::Interval projectLineSegment(const LineSegment &segment) const
Computes the interval of the projection of a line segment onto this line.
LineSegment & segment0()
Gets the swept line segment's first line segment, i.e. at t=0.