10#include <klm/eklm/geometry/Line2D.h>
13#include <klm/eklm/geometry/Circle2D.h>
39 double t[2], angles[2];
48 double t[2], angles[2];
51 for (i = 0; i < n; i++)
69 double a1, a2, b1, b2, c1, c2, d, dt[2];
72 b1 = -line.getVector().x();
73 b2 = -line.getVector().y();
74 c1 =
m_Point.x() - line.getInitialPoint().x();
75 c2 =
m_Point.y() - line.getInitialPoint().y();
76 d = a1 * b2 - a2 * b1;
80 dt[0] = c1 * b2 - c2 * b1;
81 dt[1] = a1 * c2 - a2 * c1;
86 intersection->setZ(0);
98 double t[2],
double angles[2])
const
101 double a, b, c, d, x0, y0;
103 x0 =
m_Point.x() - circleCenter.x();
104 y0 =
m_Point.y() - circleCenter.y();
108 d = b * b - 4 * a * c;
112 t[0] = -b / (2.0 * a);
115 intersections[0].setZ(0);
116 angles[0] = atan2(intersections[0].y() - circleCenter.y(),
117 intersections[0].x() - circleCenter.x());
120 t[0] = (-b -
sqrt(d)) / (2.0 * a);
121 t[1] = (-b +
sqrt(d)) / (2.0 * a);
122 for (i = 0; i < 2; i++) {
125 intersections[i].setZ(0);
126 angles[i] = atan2(intersections[i].y() - circleCenter.y(),
127 intersections[i].x() - circleCenter.x());
133 bool* condition,
int n)
const
137 for (i = 0; i < n; i++) {
140 intersections[j] = intersections[i];
bool angleWithinRange(double angle) const
Check if angle is within the arc.
const HepGeom::Point3D< double > & getCenter() const
Get center.
double getRadius() const
Get radius.
int findIntersection(const Line2D &line, HepGeom::Point3D< double > *intersection) const
Find intersection with a line.
int selectIntersections(HepGeom::Point3D< double > *intersections, bool *condition, int n) const
Select intersections.
Line2D(double x, double y, double vecx, double vecy)
Constructor.
HepGeom::Point3D< double > m_Point
Initial point.
HepGeom::Vector3D< double > m_Vector
Vector.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.