mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 09:00:34 +00:00
new pmodel: Central Inversion (for Euclidean)
This commit is contained in:
parent
15a9b6135b
commit
fc43a4716b
@ -589,6 +589,7 @@ const modelinfo models[int(mdPolynomial)+1] = {
|
||||
{X3("spiral/ring"), mf::hyper_or_torus | mf::quasiband},
|
||||
{X3("native perspective"), 0},
|
||||
{X3("azimuthal equi-volume"), mf::azimuthal | mf::equivolume | mf::euc_boring},
|
||||
{X3("central inversion"), mf::azimuthal | mf::conformal},
|
||||
{X3(""), 0},
|
||||
{X3(""), 0},
|
||||
{X3(""), 0},
|
||||
|
@ -260,7 +260,7 @@ enum eModel {
|
||||
mdHemisphere, mdBandEquidistant, mdBandEquiarea, mdSinusoidal, mdTwoPoint,
|
||||
mdFisheye, mdJoukowsky, mdJoukowskyInverted,
|
||||
mdRotatedHyperboles, mdSpiral, mdPerspective,
|
||||
mdEquivolume,
|
||||
mdEquivolume, mdCentralInversion,
|
||||
mdGUARD, mdUnchanged, mdHyperboloidFlat, mdPolynomial, mdRug, mdFlatten
|
||||
};
|
||||
|
||||
|
@ -635,6 +635,7 @@ namespace conformal {
|
||||
if(DIM == 2 && pm == mdPerspective) return false;
|
||||
if(DIM == 2 && pm == mdEquivolume) return false;
|
||||
if(DIM == 3 && among(pm, mdBall, mdHyperboloid, mdFormula, mdPolygonal, mdRotatedHyperboles, mdSpiral, mdHemisphere)) return false;
|
||||
if(pm == mdCentralInversion && !euclid) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -751,7 +752,7 @@ namespace conformal {
|
||||
eModel m = eModel(i);
|
||||
if(m == mdFormula && ISMOBILE) continue;
|
||||
if(model_available(m)) {
|
||||
dialog::addBoolItem(get_model_name(m), pmodel == m, "0123456789!@#$%^&*()]" [m]);
|
||||
dialog::addBoolItem(get_model_name(m), pmodel == m, "0123456789!@#$%^&*()]['" [m]);
|
||||
dialog::add_action([m] () {
|
||||
if(m == mdFormula) {
|
||||
edit_formula();
|
||||
|
@ -958,6 +958,7 @@ void dqi_poly::draw() {
|
||||
if(pmodel == mdJoukowskyInverted && vid.skiprope) can_have_inverse = true;
|
||||
if(pmodel == mdDisk && hyperbolic && vid.alpha <= -1) can_have_inverse = true;
|
||||
if(pmodel == mdSpiral && vid.skiprope) can_have_inverse = true;
|
||||
if(pmodel == mdCentralInversion) can_have_inverse = true;
|
||||
|
||||
if(can_have_inverse && !(poly_flags & POLY_ISSIDE)) {
|
||||
|
||||
@ -966,6 +967,7 @@ void dqi_poly::draw() {
|
||||
|
||||
else {
|
||||
if(d < 0) poly_flags ^= POLY_INVERSE;
|
||||
if(pmodel == mdCentralInversion) poly_flags ^= POLY_INVERSE;
|
||||
compute_side_by_area();
|
||||
}
|
||||
|
||||
|
@ -309,6 +309,15 @@ void applymodel(hyperpoint H, hyperpoint& ret) {
|
||||
return;
|
||||
}
|
||||
|
||||
case mdCentralInversion: {
|
||||
ld tz = get_tz(H);
|
||||
for(int d=0; d<DIM; d++) ret[d] = H[d] / tz;
|
||||
ld r = 0;
|
||||
for(int d=0; d<DIM; d++) r += ret[d]*ret[d];
|
||||
for(int d=0; d<DIM; d++) ret[d] /= r;
|
||||
return;
|
||||
}
|
||||
|
||||
case mdHalfplane: {
|
||||
// Poincare to half-plane
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user