arb:: finish_apeirogon now works with material vertices too

This commit is contained in:
Zeno Rogue 2022-04-25 00:19:30 +02:00
parent 8e3c5d367c
commit ad6430a97f
1 changed files with 20 additions and 14 deletions

View File

@ -354,21 +354,27 @@ void geometry_information::finish_apeirogon(hyperpoint center) {
last->flags |= POLY_APEIROGONAL; last->flags |= POLY_APEIROGONAL;
last->she = isize(hpc); last->she = isize(hpc);
hyperpoint b = hpc.back(); hyperpoint b = hpc.back();
for(int i=1; i<15; i++) hpcpush(towards_inf(b, center, i)); if(material(-1e-9 * C0 + center) > 0) {
hyperpoint h = 1e-9 * C0 + center; hpcpush(normalize(center));
if(material(h) > 0) }
hpcpush(normalize(h)); else {
else { for(int i=1; i<15; i++) hpcpush(towards_inf(b, center, i));
ld left = -atan2(towards_inf(b, center, 15)); hyperpoint h = 1e-9 * C0 + center;
ld right = -atan2(towards_inf(hpc[last->s], center, 15)); if(material(h) > 0)
if(right > left + 180*degree) right -= 360*degree; hpcpush(normalize(h));
if(right < left - 180*degree) right += 360*degree; else {
hyperpoint l1 = towards_inf(b, center, 15); l1 /= l1[2]; ld left = -atan2(towards_inf(b, center, 15));
hyperpoint l2 = xspinpush0(left, 15); l2 /= l2[2]; ld right = -atan2(towards_inf(hpc[last->s], center, 15));
/* call hpc.push_back directly to avoid adding points */ if(right > left + 180*degree) right -= 360*degree;
for(int i=0; i<=10; i++) hpc.push_back(xspinpush0(lerp(left, right, i/10.), 15)); 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];
println(hlog, "doing that ", left, "..", right);
/* 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));
} }
for(int i=15; i>=1; i--) hpcpush(towards_inf(hpc[last->s], center, i));
hpcpush(hpc[last->s]); hpcpush(hpc[last->s]);
} }