Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Polygon.hh
Go to the documentation of this file.
1#ifndef G_POLYGON_H
2#define G_POLYGON_H
3
4#include <vector>
5
6namespace Garfield {
7
8namespace Polygon {
9
10/// Determine whether the point (x, y) is located inside of the
11/// polygon (xpl, ypl).
12void Inside(const std::vector<double>& xpl, const std::vector<double>& ypl,
13 const double x, const double y, bool& inside, bool& edge);
14
15/// Determine the (signed) area of a polygon.
16double Area(const std::vector<double>& xp, const std::vector<double>& yp);
17
18/// Check whether a set of points builds a non-trivial polygon.
19bool NonTrivial(const std::vector<double>& xp, const std::vector<double>& yp);
20
21/// Try to eliminate "butterflies" (crossing of two adjacent segments
22/// of a polygon), by point exchanges.
23void EliminateButterflies(std::vector<double>& xp, std::vector<double>& yp,
24 std::vector<double>& zp);
25}
26
27}
28
29#endif
bool NonTrivial(const std::vector< double > &xp, const std::vector< double > &yp)
Check whether a set of points builds a non-trivial polygon.
Definition: Polygon.cc:285
double Area(const std::vector< double > &xp, const std::vector< double > &yp)
Determine the (signed) area of a polygon.
Definition: Polygon.cc:274
void EliminateButterflies(std::vector< double > &xp, std::vector< double > &yp, std::vector< double > &zp)
Definition: Polygon.cc:355
void Inside(const std::vector< double > &xpl, const std::vector< double > &ypl, const double x, const double y, bool &inside, bool &edge)
Definition: Polygon.cc:187