21 namespace VerticesHelper {
34 std::vector<double> phiRefs = {},
35 double phiTolerance = 1
e-6) {
42 phiSegments.push_back(
phiMin);
43 for (
unsigned int iq = 1; iq < 4; ++iq) {
44 if (
phiMin < quarters[iq] and phiMax > quarters[iq]) {
45 phiSegments.push_back(quarters[iq]);
48 phiSegments.push_back(phiMax);
50 phiSegments = quarters;
53 if (not phiRefs.empty()) {
54 for (
const auto& phiRef : phiRefs) {
56 auto match = std::find_if(
57 phiSegments.begin(), phiSegments.end(), [&](
double phiSeg) {
58 return std::abs(phiSeg - phiRef) < phiTolerance;
60 if (match == phiSegments.end()) {
61 phiSegments.push_back(phiRef);
64 std::sort(phiSegments.begin(), phiSegments.end());
83 template <
typename vertex_t,
typename transform_t>
85 std::pair<double, double> rxy,
double phi1,
double phi2,
86 unsigned int lseg,
int addon = 0,
87 const vertex_t&
offset = vertex_t::Zero(),
88 const transform_t&
transform = transform_t::Identity()) {
90 unsigned int segs =
std::abs(phi2 - phi1) / (2 *
M_PI) * lseg;
91 segs = segs > 0 ? segs : 1;
92 double phistep = (phi2 - phi1) / segs;
94 for (
unsigned int iphi = 0; iphi < segs + addon; ++iphi) {
95 double phi = phi1 + iphi * phistep;
96 vertex_t vertex = vertex_t::Zero();
97 vertex(0) = rxy.first * std::cos(phi);
98 vertex(1) = rxy.second * std::sin(phi);
116 double outerRx,
double outerRy,
118 double halfPhi =
M_PI,
119 unsigned int lseg = 1) {
122 std::vector<Acts::Vector2D> rvertices;
123 std::vector<Acts::Vector2D> ivertices;
124 std::vector<Acts::Vector2D> overtices;
126 bool innerExists = (innerRx > 0. and innerRy > 0.);
131 avgPhi - halfPhi, avgPhi + halfPhi, {avgPhi});
134 for (
unsigned int iseg = 0; iseg < phiSegs.size() - 1; ++iseg) {
135 int addon = (iseg == phiSegs.size() - 2 and not
closed) ? 1 : 0;
137 detail::VerticesHelper::createSegment<Vector2D, Eigen::Affine2d>(
138 ivertices, {innerRx, innerRy}, phiSegs[iseg], phiSegs[iseg + 1], lseg,
141 detail::VerticesHelper::createSegment<Vector2D, Eigen::Affine2d>(
142 overtices, {outerRx, outerRy}, phiSegs[iseg], phiSegs[iseg + 1], lseg,
147 if (not innerExists) {
150 rvertices.push_back(
Vector2D(0., 0.));
152 rvertices.insert(rvertices.end(), overtices.begin(), overtices.end());
153 }
else if (not closed) {
154 rvertices.insert(rvertices.end(), overtices.begin(), overtices.end());
155 rvertices.insert(rvertices.end(), ivertices.rbegin(), ivertices.rend());
157 rvertices.insert(rvertices.end(), overtices.begin(), overtices.end());
158 rvertices.insert(rvertices.end(), ivertices.begin(), ivertices.end());
174 double halfPhi =
M_PI,
175 unsigned int lseg = 1) {
190 template <
typename vertex_t,
typename vertex_container_t>
192 const vertex_container_t& vertices) {
200 auto lineSide = [&](
auto&& ll0,
auto&& ll1) {
202 auto delta = point - ll0;
206 auto iv = std::begin(vertices);
210 auto reference = lineSide(l0, l1);
211 for (++iv; iv != std::end(vertices); ++iv) {
214 if (lineSide(l0, l1) != reference) {
219 if (lineSide(l1, *std::begin(vertices)) != reference) {
236 template <
typename vertex_t>
238 const vertex_t& upperRight) {
239 return (lowerLeft[0] <= point[0]) && (point[0] < upperRight[0]) &&
240 (lowerLeft[1] <= point[1]) && (point[1] < upperRight[1]);