From 8e3c5d367c5ddc570f05fdac5382caba2a028daf Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 25 Apr 2022 00:08:27 +0200 Subject: [PATCH] finish_apeirogon now works with ultra-ideal center --- floorshapes.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/floorshapes.cpp b/floorshapes.cpp index a6173b15..04632dfa 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -355,7 +355,19 @@ void geometry_information::finish_apeirogon(hyperpoint center) { last->she = isize(hpc); hyperpoint b = hpc.back(); for(int i=1; i<15; i++) hpcpush(towards_inf(b, center, i)); - hpcpush(normalize(1e-9 * C0 + center)); + hyperpoint h = 1e-9 * C0 + center; + if(material(h) > 0) + hpcpush(normalize(h)); + else { + ld left = -atan2(towards_inf(b, center, 15)); + ld right = -atan2(towards_inf(hpc[last->s], center, 15)); + if(right > left + 180*degree) right -= 360*degree; + if(right < left - 180*degree) right += 360*degree; + hyperpoint l1 = towards_inf(b, center, 15); l1 /= l1[2]; + hyperpoint l2 = xspinpush0(left, 15); l2 /= l2[2]; + /* call hpc.push_back directly to avoid adding points */ + for(int i=0; i<=10; i++) hpc.push_back(xspinpush0(lerp(left, right, i/10.), 15)); + } for(int i=15; i>=1; i--) hpcpush(towards_inf(hpc[last->s], center, i)); hpcpush(hpc[last->s]); }