From 76aee72fab63e6385e198098d89fb50fb5f852e7 Mon Sep 17 00:00:00 2001 From: namark <namark@disroot.org> Date: Sun, 9 Aug 2020 02:57:39 +0400 Subject: [PATCH] Midpoint is special now, halfway is simple. --- common/math.hpp | 8 ++++---- no_trig_rotation.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/math.hpp b/common/math.hpp index 9bd5e7b..d7d761c 100644 --- a/common/math.hpp +++ b/common/math.hpp @@ -96,7 +96,7 @@ class protractor static constexpr array circle = []() { - using support::midpoint; + using support::halfway; array points{}; @@ -109,8 +109,8 @@ class protractor if(end - begin <= 2) return; - auto middle = midpoint(begin, end); - *(middle) = normalize(midpoint(*begin, *(end - 1))); + auto middle = halfway(begin, end); + *(middle) = normalize(halfway(*begin, *(end - 1))); self(begin, middle + 1, self); @@ -120,7 +120,7 @@ class protractor if(Exponent > 0) { - auto middle = midpoint(points.begin(), points.end()); + auto middle = halfway(points.begin(), points.end()); *middle = vector::j(); bisect(points.begin(), middle + 1, diff --git a/no_trig_rotation.cpp b/no_trig_rotation.cpp index 0cd3602..db03c65 100644 --- a/no_trig_rotation.cpp +++ b/no_trig_rotation.cpp @@ -60,7 +60,7 @@ class protractor static constexpr array circle = []() { - using support::midpoint; + using support::halfway; array points{}; @@ -79,11 +79,11 @@ class protractor // otherwise // we're going to put the new bisector in the middle of provided range - auto middle = midpoint(begin, end); - // the bisector itself lies on the midpoint between the two points, + auto middle = halfway(begin, end); + // the bisector itself lies halfway between the two points, // since both are on circle. // need to normalize it to stay on the circle for subsequent bisections - *(middle) = normalize(midpoint(*begin, *(end - 1))); + *(middle) = normalize(halfway(*begin, *(end - 1))); // do the same for the two bisected parts self(begin, middle + 1, @@ -96,7 +96,7 @@ class protractor { // have to handle the case of first bisection separately, // since can't normalize vector 0 :/ - auto middle = midpoint(points.begin(), points.end()); + auto middle = halfway(points.begin(), points.end()); *middle = vector::j(); bisect(points.begin(), middle + 1, -- GitLab