12 std::vector<Vector2D> vtxs =
vertices();
13 sl <<
"Acts::ConvexPolygonBounds<" << vtxs.size() <<
">: vertices: [x, y]\n";
14 for (
size_t i = 0; i < vtxs.size(); i++) {
15 const auto& vtx = vtxs[i];
20 sl <<
"[" << vtx.x() <<
", " << vtx.y() <<
"]";
25 template <
typename coll_t>
27 const coll_t& vertices) {
32 for (
size_t i = 1; i < vertices.size(); i++) {
33 vmax = vmax.cwiseMax(vertices[i]);
34 vmin = vmin.cwiseMin(vertices[i]);
41 std::vector<double>
values;
42 for (
const auto& vtx : vertices()) {
43 values.push_back(vtx.x());
44 values.push_back(vtx.y());
49 template <
typename coll_t>
51 const coll_t& vertices) noexcept(
false) {
53 "Must be collection of Vector2D");
55 const size_t N = vertices.size();
56 for (
size_t i = 0; i <
N; i++) {
57 size_t j = (i + 1) % N;
67 for (
size_t k = 0;
k <
N;
k++) {
68 if (
k == i ||
k == j) {
73 double dot = normal.dot(c - a);
76 ref = std::signbit(dot);
81 if (std::signbit(dot) != ref) {
82 throw std::logic_error(
83 "ConvexPolygon: Given vertices do not form convex hull");
91 const std::vector<Acts::Vector2D>& vertices) noexcept(
false)
92 : m_vertices(), m_boundingBox(makeBoundingBox(vertices)) {
94 "Size and number of given vertices do not match.");
95 for (
size_t i = 0; i <
N; i++) {
96 m_vertices[i] = vertices[i];
104 : m_vertices(vertices), m_boundingBox(makeBoundingBox(vertices)) {
111 : m_vertices(), m_boundingBox(0., 0.) {
112 for (
size_t i = 0; i <
N; i++) {
115 makeBoundingBox(m_vertices);
127 return bcheck.
isInside(lposition, m_vertices);
138 unsigned int )
const {
139 return {m_vertices.begin(), m_vertices.end()};
144 return m_boundingBox;
149 convex_impl(m_vertices);
153 const std::vector<Vector2D>& vertices)
154 : m_vertices(vertices.begin(), vertices.end()),
155 m_boundingBox(makeBoundingBox(vertices)) {}
164 return bcheck.
isInside(lposition, m_vertices);
169 return BoundaryCheck(
true).distance(lposition, m_vertices);
174 return {m_vertices.begin(), m_vertices.end()};
179 return m_boundingBox;
184 convex_impl(m_vertices);