19const double EPSILON = std::numeric_limits<double>::epsilon();
29 : m_start(start), m_end(end), m_dir(m_end - m_start) {}
51 double sa = a.
X() * b.
Y() - b.
X() * a.
Y();
58 if ((a.
X() * b.
X() < 0.0) || (a.
Y() * b.
Y() < 0.0)) {
64 if (edge.
start() == p2) {
67 if (edge.
end() == p2) {
122 crossPoint = edgeTwo.
start();
124 crossPoint = edgeTwo.
end();
126 crossPoint = edgeOne.
start();
128 crossPoint = edgeOne.
end();
130 crossPoint = edgeTwo.
point(t);
150 double ca = va.
X() * vb.Y();
151 double cb = vb.X() * va.Y();
155 return (aclass !=
OnLeft);
158 return (aclass !=
Beyond);
const double EPSILON(1.0E-10)
PolygonEdge Defines a directed edge between two points on a polygon.
const Kernel::V2D & end() const
Access the end point.
const Kernel::V2D & direction() const
Return the direction.
PolygonEdge()
Default constructor.
const Kernel::V2D & start() const
Access the start point.
Kernel::V2D point(const double fraction) const
Create a point a given fraction along this edge.
Orientation
Defines the orientation with respect to another edge.
@ SkewNoCross
Edges are at an angle and do not intersect.
@ Parallel
Edges point in the same direction.
@ Skew
Edges are at an angle to each other.
@ Collinear
Edges lie on the same line.
@ SkewCross
Edges are at an angle and intersect.
const Kernel::V2D m_dir
Direction vector.
Implements a 2-dimensional vector embedded in a 3D space, i.e.
double Y() const
Y position.
double scalar_prod(const V2D &other) const
Compute the scalar product with another vector.
double X() const
X position.
double norm() const
Compute the norm.
MANTID_GEOMETRY_DLL PolygonEdge::Orientation orientation(const PolygonEdge &focusEdge, const PolygonEdge &refEdge, double &t)
Calculate the orientation type of one edge wrt to another.
MANTID_GEOMETRY_DLL PointClassification classify(const Kernel::V2D &pt, const PolygonEdge &edge)
Helper function for classification.
MANTID_GEOMETRY_DLL bool edgeAimsAt(const PolygonEdge &a, const PolygonEdge &b, PointClassification aclass, PolygonEdge::Orientation crossType)
Return if the edges aim at each other.
MANTID_GEOMETRY_DLL PolygonEdge::Orientation crossingPoint(const PolygonEdge &edgeOne, const PolygonEdge &edgeTwo, Kernel::V2D &crossPoint)
Calculate the crossing point of one edge with wrt another.
PointClassification
Enumeration for point type w.r.t an edge.
@ Destination
Point equals edge destination.
@ OnRight
Point is to right of edge.
@ Between
Point is between edge origin and destination.
@ OnLeft
Point is to left of edge.
@ Origin
Point equals edge origin.
@ Behind
Point is left of edge origin.
@ Beyond
Point is right of edge destination.
MANTID_KERNEL_DLL bool equals(const T x, const T y)
Test for equality of doubles using compiler-defined precision.
MANTID_KERNEL_DLL bool ltEquals(const T x, const T y)
Test whether x<=y within machine precision.
MANTID_KERNEL_DLL bool gtEquals(const T x, const T y)
Test whether x>=y within machine precision.