diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-07 17:13:38 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-07 17:13:38 +0000 |
commit | 381caebb524a5bb8f091d1aa2ca02d384e010961 (patch) | |
tree | 1f006fe4bdcecabdb402f999a6fc9d0d52c8f34d /lib | |
parent | Merge branch 'template-types' (diff) | |
download | ilt-381caebb524a5bb8f091d1aa2ca02d384e010961.tar.bz2 ilt-381caebb524a5bb8f091d1aa2ca02d384e010961.tar.xz ilt-381caebb524a5bb8f091d1aa2ca02d384e010961.zip |
Global positions in network data
Diffstat (limited to 'lib')
-rw-r--r-- | lib/maths.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/maths.h b/lib/maths.h index b5af9ca..781fc4c 100644 --- a/lib/maths.h +++ b/lib/maths.h @@ -157,9 +157,9 @@ find_arc_centre(glm::vec<2, T, Q> start, Rotation2D startDir, glm::vec<2, T, Q> { const auto det = endDir.x * startDir.y - endDir.y * startDir.x; if (det != 0) { // near parallel line will yield noisy results - const auto d = end - start; + const glm::vec<2, RelativeDistance, Q> d = end - start; const auto u = (d.y * endDir.x - d.x * endDir.y) / det; - return {start + startDir * u, u < 0}; + return {start + glm::vec<2, T, Q>(startDir * u), u < 0}; } throw std::runtime_error("no intersection"); } @@ -188,7 +188,9 @@ find_arcs_radius(glm::vec<2, T, Q> start, Rotation2D ad, glm::vec<2, T, Q> end, // W+W^(2)-4)) // These exist cos limitations of online formula rearrangement, and I'm OK with that. - const auto &m {start.x}, &n {start.y}, &o {end.x}, &p {end.y}; + // const auto &m {start.x}, &n {start.y}, &o {end.x}, &p {end.y}; + const RelativePosition2D diff {end - start}, other {}; + const auto &m {other.x}, &n {other.y}, &o {diff.x}, &p {diff.y}; const auto &X {ad.x}, &Y {ad.y}, &Z {bd.x}, &W {bd.y}; return (2 * m * X - 2 * X * o - 2 * m * Z + 2 * o * Z + 2 * n * Y - 2 * Y * p - 2 * n * W + 2 * p * W |