summaryrefslogtreecommitdiff
path: root/utility/maths.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-02-27 20:07:18 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-27 20:07:18 +0000
commit491cdb55efed10a31be0d21ede5bbfe289fb83ca (patch)
tree5cb85e20f00f9c65db6778c05597845558f0c154 /utility/maths.cpp
parentOperator! to convert vec3 to vec2 (diff)
downloadilt-491cdb55efed10a31be0d21ede5bbfe289fb83ca.tar.bz2
ilt-491cdb55efed10a31be0d21ede5bbfe289fb83ca.tar.xz
ilt-491cdb55efed10a31be0d21ede5bbfe289fb83ca.zip
find_arc_centre given vectors
Diffstat (limited to 'utility/maths.cpp')
-rw-r--r--utility/maths.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/utility/maths.cpp b/utility/maths.cpp
index bda6ea6..866097a 100644
--- a/utility/maths.cpp
+++ b/utility/maths.cpp
@@ -69,7 +69,12 @@ find_arc_centre(glm::vec2 as, float entrys, glm::vec2 bs, float entrye)
const auto perpe = entrye - half_pi;
const glm::vec2 ad {std::sin(perps), std::cos(perps)};
const glm::vec2 bd {std::sin(perpe), std::cos(perpe)};
+ return find_arc_centre(as, ad, bs, bd);
+}
+std::pair<glm::vec2, bool>
+find_arc_centre(glm::vec2 as, glm::vec2 ad, glm::vec2 bs, glm::vec2 bd)
+{
const auto det = bd.x * ad.y - bd.y * ad.x;
if (det != 0) { // near parallel line will yield noisy results
const auto d = bs - as;