19 namespace VerticesHelper {
30 const std::vector<double>& phiRefs = {},
31 double phiTolerance = 1
e-6);
47 template <
typename vertex_t,
typename transform_t>
49 std::pair<double, double> rxy,
double phi1,
double phi2,
50 unsigned int lseg,
int addon = 0,
51 const vertex_t&
offset = vertex_t::Zero(),
52 const transform_t&
transform = transform_t::Identity()) {
54 unsigned int segs =
std::abs(phi2 - phi1) / (2 *
M_PI) * lseg;
55 segs = segs > 0 ? segs : 1;
56 double phistep = (phi2 - phi1) / segs;
58 for (
unsigned int iphi = 0; iphi < segs + addon; ++iphi) {
59 double phi = phi1 + iphi * phistep;
60 vertex_t vertex = vertex_t::Zero();
61 vertex(0) = rxy.first *
std::cos(phi);
62 vertex(1) = rxy.second * std::sin(phi);
79 double outerRx,
double outerRy,
81 double halfPhi =
M_PI,
82 unsigned int lseg = 1);
94 double halfPhi =
M_PI,
95 unsigned int lseg = 1);
106 template <
typename vertex_t,
typename vertex_container_t>
108 const vertex_container_t& vertices) {
116 auto lineSide = [&](
auto&& ll0,
auto&& ll1) {
117 auto normal = ll1 - ll0;
118 auto delta = point - ll0;
119 return std::signbit((normal[0] *
delta[1]) - (normal[1] * delta[0]));
122 auto iv = std::begin(vertices);
126 auto reference = lineSide(l0, l1);
127 for (++iv; iv != std::end(vertices); ++iv) {
130 if (lineSide(l0, l1) != reference) {
135 if (lineSide(l1, *std::begin(vertices)) != reference) {
152 template <
typename vertex_t>
154 const vertex_t& upperRight) {
155 return (lowerLeft[0] <= point[0]) && (point[0] < upperRight[0]) &&
156 (lowerLeft[1] <= point[1]) && (point[1] < upperRight[1]);
164 bool onHyperPlane(
const std::vector<Vector3D>& vertices,