10#include <klm/eklm/geometry/Polygon2D.h>
13#include <framework/core/RandomNumbers.h>
22 for (i = 0; i < n; i++) {
33 for (i = 0; i < m_nPoints; i++)
34 delete m_LineSegments[i];
35 delete[] m_LineSegments;
40 int i, n, nIntersections;
45 angle = gRandom->Uniform(0., 2.0 * M_PI);
46 Line2D line(point.x(), point.y(), cos(angle), sin(angle));
47 for (i = 0; i < m_nPoints; i++) {
48 n = m_LineSegments[i]->Line2D::findIntersection(line, &intersection, t);
52 if (t[0] == 0 || t[0] == 1)
54 if (t[0] > 0 && t[0] < 1 && t[1] > 0)
58 if (nIntersections % 2 == 1)
67 for (i = 0; i < m_nPoints; i++) {
68 if (m_LineSegments[i]->findIntersection(lineSegment, &intersection) > 0)
80 for (i = 0; i < m_nPoints; i++) {
81 if (m_LineSegments[i]->findIntersection(arc, intersections) > 0)
92 for (i = 0; i < m_nPoints; i++) {
97 polygon.
pointInside(m_LineSegments[0]->getInitialPoint()))
HepGeom::Point3D< double > getInitialPoint() const
Get initial point.
const HepGeom::Point3D< double > & getInitialPoint() const
Get initial point.
Polygon2D(const HepGeom::Point3D< double > *points, int n)
Constructor.
bool pointInside(const HepGeom::Point3D< double > &point) const
Check if point is inside the polygon.
bool hasIntersection(const LineSegment2D &lineSegment) const
Check whether polygon has an intersection with a line segment or this line segment is fully inside th...
LineSegment2D ** m_LineSegments
Line segments.
LineSegment2D ** getLineSegments() const
Get line segments.
Abstract base class for different kinds of events.