10#include <klm/eklm/geometry/LineSegment2D.h>
16 Line2D(point1.x(), point1.y(),
17 point2.x() - point1.x(), point2.y() - point1.y())
27findIntersection(
const Line2D& line,
36 condition = tWithinRange(t[0]);
37 return selectIntersections(intersection, &condition, 1);
57findIntersection(
const Circle2D& circle,
61 double t[2], angles[2];
62 bool condition[2] = {
false,
false};
64 for (i = 0; i < n; i++)
65 condition[i] = tWithinRange(t[i]);
66 return selectIntersections(intersections, condition, n);
71findIntersection(
const Arc2D& arc,
75 double t[2], angles[2];
76 bool condition[2] = {
false,
false};
78 for (i = 0; i < n; i++)
79 condition[i] = tWithinRange(t[i]) && arc.angleWithinRange(angles[i]);
80 return selectIntersections(intersections, condition, n);
85 return (t >= 0 && t <= 1);
int findIntersection(const Line2D &line, HepGeom::Point3D< double > *intersection) const
Find intersection with a line.
static int selectIntersections(HepGeom::Point3D< double > *intersections, const bool *condition, int n)
Select intersections.
Line2D(double x, double y, double vecx, double vecy)
Constructor.
~LineSegment2D()
Destructor.
int findIntersection(const Line2D &line, HepGeom::Point3D< double > *intersection) const
Find intersection with a line.
LineSegment2D(const HepGeom::Point3D< double > &point1, const HepGeom::Point3D< double > &point2)
Constructor.
static bool tWithinRange(double t)
Check if t is within the line segment (0 <= t <= 1).
Abstract base class for different kinds of events.