1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-08 06:59:55 +00:00

small hyperboloid projection

This commit is contained in:
Zeno Rogue 2024-06-27 22:32:09 +02:00
parent 8aee11dd5f
commit 3a255db948
3 changed files with 16 additions and 2 deletions

View File

@ -258,6 +258,7 @@ struct projection_configuration {
ld offside, offside2;
ld aitoff_parameter, miller_parameter, loximuthal_parameter, winkel_parameter;
bool show_hyperboloid_flat;
bool small_hyperboloid;
bool collignon_reflected;
string formula;
eModel basic_model;

View File

@ -1007,6 +1007,8 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
}
#endif
if(pconf.small_hyperboloid) H = mid(H, C0);
ret = H;
if(sphere && pmodel == mdHyperboloidFlat) {
@ -2673,7 +2675,9 @@ EX void draw_model_elements() {
case mdHemisphere: {
if(!pconf.show_hyperboloid_flat) return;
if(models::is_hyperboloid(pmodel)) {
#if CAP_QUEUE
if(pconf.small_hyperboloid) queueaction(PPR::CIRCLE, [] { glflush(); pconf.small_hyperboloid = false; });
curvepoint(point3(0,0,1));
curvepoint(point3(0,0,-pconf.alpha));
queuecurve(shiftless(Id), ringcolor, 0, PPR::CIRCLE);
@ -2709,6 +2713,7 @@ EX void draw_model_elements() {
a[0] = -a[0];
curvepoint(a);
queuecurve(shiftless(Id), ringcolor, 0, PPR::CIRCLE);
if(pconf.small_hyperboloid) queueaction(PPR::CIRCLE, [] { glflush(); pconf.small_hyperboloid = true; });
#endif
}
return;
@ -3004,8 +3009,9 @@ EX void draw_boundary(int w) {
queuereset(pmodel, p1);
}
int mul = pconf.small_hyperboloid ? 2 : 1;
for(ld t=0; t<=360; t ++)
curvepoint(xspinpush0(t * degree, it ? M_PI - mz : mz));
curvepoint(xspinpush0(t * degree, it ? M_PI - mz * mul: mz * mul));
if(p1 == PPR::OUTCIRCLE) { queuecurve_reuse(shiftless(Id), lc, fc1, p1); fc1 = 0; p1 = PPR::CIRCLE; }
queuecurve(shiftless(Id), lc, fc1, p1);

View File

@ -140,6 +140,7 @@ projection_configuration::projection_configuration() {
*ptr_ball = cspin(1, 2, 20._deg);
ptr_camera = new transmatrix; *ptr_camera = Id;
offside = 0; offside2 = M_PI;
small_hyperboloid = false;
}
EX namespace models {
@ -625,8 +626,10 @@ EX namespace models {
add_edit(vpconf.fisheye_alpha);
}
if(is_hyperboloid(vpmodel))
if(is_hyperboloid(vpmodel)) {
add_edit(pconf.show_hyperboloid_flat);
add_edit(pconf.small_hyperboloid);
}
if(vpmodel == mdCollignon)
add_edit(vpconf.collignon_parameter);
@ -1041,6 +1044,10 @@ EX namespace models {
param_b(p.show_hyperboloid_flat, sp+"hyperboloid-flat", true)
-> editable("show flat", 'b');
param_b(p.small_hyperboloid, sp+"hyperboloid-small", true)
-> editable("small hyperboloid model", 't')
-> help("as in Clifford algebras");
param_f(p.skiprope, sp+"mobius", 0)
-> editable(0, 360, 15, "Möbius transformations", "", 'S')->unit = "°";