models:: central cylindrical and in-progress Collignon

This commit is contained in:
Zeno Rogue 2019-08-14 17:13:20 +02:00
parent 9e79872780
commit 9d573ebd07
4 changed files with 32 additions and 2 deletions

View File

@ -609,6 +609,8 @@ const modelinfo mdinf[int(mdPolynomial)+1] = {
{X3("two-point hybrid"), mf::euc_boring | mf::twopoint},
{X3("geodesic"), 0},
{X3("Mollweide"), mf::euc_boring | mf::pseudoband | mf::equiarea },
{X3("central cylindrical"), mf::euc_boring | mf::band },
{X3("Collignon"), mf::pseudoband | mf::equiarea },
{X3(""), 0},
{X3("polynomial"), mf::conformal}
};

View File

@ -286,7 +286,7 @@ enum eModel {
// 20..24
mdEquivolume, mdCentralInversion, mdSimulatedPerspective, mdTwoHybrid, mdGeodesic,
// 25
mdMollweide,
mdMollweide, mdCentralCyl, mdCollignon,
// 26..
mdGUARD, mdUnchanged, mdHyperboloidFlat, mdPolynomial, mdRug, mdFlatten
};

View File

@ -698,6 +698,9 @@ ld period_at(ld y) {
return m * 2 * cos(y * M_PI);
case mdMollweide:
return (abs(y) > .5-1e-6) ? m * 2 : m * 2 * sqrt(1 - y*y*4);
case mdCollignon:
// return (y < -.499999) ? m*2 : m*(1+2*y);
return (abs(y) < 1e-6) ? m*2 : m*2*y; // y = signed_sqrt(sin_auto(y) + whatever[0]);
default:
return m * 2;
}

View File

@ -677,6 +677,31 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
});
break;
case mdCentralCyl:
makeband(H, ret, [] (ld& x, ld& y) { y = tan_auto(y); });
break;
case mdCollignon:
find_zlev(H); /* does not look nicely otherwise */
if(hyperbolic) H = ypush(-1) * H;
makeband(H, ret, [] (ld& x, ld& y) {
auto signed_sqrt = [] (ld x) { return x > 0 ? sqrt(x) : -sqrt(-x); };
/*
if(sphere) {
y = M_PI / 2 - y;
x = sin_auto(y/2) * x;
y = (sin_auto(y/2) - .5) * M_PI;
}
if(hyperbolic) {
ld mul = signed_sqrt(sinh(y) + 1);
x *= mul;
y = mul + signed_sqrt(sinh(1) + 1);
}*/
y = signed_sqrt(sin_auto(y) + whatever[0]);
x *= y;
});
break;
case mdBandEquiarea:
makeband(H, ret, [] (ld& x, ld& y) { y = sin_auto(y); });
break;
@ -1679,7 +1704,7 @@ EX void draw_boundary(int w) {
return;
}
case mdBand: case mdBandEquidistant: case mdBandEquiarea: case mdSinusoidal: case mdMollweide: {
case mdBand: case mdBandEquidistant: case mdBandEquiarea: case mdSinusoidal: case mdMollweide: case mdCentralCyl: case mdCollignon: {
if(DIM == 3) return;
if(pmodel == mdBand && models::model_transition != 1) return;
bool bndband = ((pmodel == mdBand) ? hyperbolic : sphere);