mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-11 18:00:34 +00:00
fisheye model
This commit is contained in:
parent
14a4375cf0
commit
f1bcd91de5
@ -534,7 +534,8 @@ namespace conformal {
|
||||
"disk", "half-plane", "band", "polygonal", "polynomial",
|
||||
"azimuthal equidistant", "azimuthal equi-area",
|
||||
"ball model", "Minkowski hyperboloid", "hemisphere",
|
||||
"band equidistant", "band equi-area", "sinusoidal", "two-point equidistant"
|
||||
"band equidistant", "band equi-area", "sinusoidal", "two-point equidistant",
|
||||
"fisheye"
|
||||
};
|
||||
|
||||
string get_model_name(eModel pm) {
|
||||
@ -640,6 +641,8 @@ namespace conformal {
|
||||
pmodel = eModel(12);
|
||||
else if(uni == '$')
|
||||
pmodel = eModel(13);
|
||||
else if(uni == '%')
|
||||
pmodel = eModel(14);
|
||||
else if(uni == '6')
|
||||
vid.alpha = 1, vid.scale = 1;
|
||||
else if(uni == 'z')
|
||||
|
1
hyper.h
1
hyper.h
@ -927,6 +927,7 @@ enum eModel {
|
||||
mdDisk, mdHalfplane, mdBand, mdPolygonal, mdPolynomial,
|
||||
mdEquidistant, mdEquiarea, mdBall, mdHyperboloid,
|
||||
mdHemisphere, mdBandEquidistant, mdBandEquiarea, mdSinusoidal, mdTwoPoint,
|
||||
mdFisheye,
|
||||
mdGUARD, mdUnchanged };
|
||||
|
||||
namespace conformal {
|
||||
|
10
hypgraph.cpp
10
hypgraph.cpp
@ -222,6 +222,16 @@ void applymodel(hyperpoint H, hyperpoint& ret) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(pmodel == mdFisheye) {
|
||||
ret[0] = H[0] / tz;
|
||||
ret[1] = H[1] / tz;
|
||||
ld hypot = sqrt(1 + ret[0]*ret[0] + ret[1]*ret[1]);
|
||||
ret[0] /= hypot;
|
||||
ret[1] /= hypot;
|
||||
ghcheck(ret, H);
|
||||
return;
|
||||
}
|
||||
|
||||
ld zlev = 1;
|
||||
bool zlev_used = false;
|
||||
|
||||
|
10
polygons.cpp
10
polygons.cpp
@ -549,7 +549,9 @@ void drawpolyline(polytodraw& p) {
|
||||
return; // too large!
|
||||
}
|
||||
|
||||
if((spherespecial > 0 || (sphere && mdAzimuthalEqui())) && !(poly_flags & POLY_ISSIDE)) {
|
||||
bool equi = mdAzimuthalEqui() || pmodel == mdFisheye;
|
||||
|
||||
if((spherespecial > 0 || (sphere && equi)) && !(poly_flags & POLY_ISSIDE)) {
|
||||
double rarea = 0;
|
||||
for(int i=0; i<size(glcoords)-1; i++)
|
||||
rarea += glcoords[i][0] * glcoords[i+1][1] - glcoords[i][1] * glcoords[i+1][0];
|
||||
@ -583,8 +585,10 @@ void drawpolyline(polytodraw& p) {
|
||||
lastl = l;
|
||||
}
|
||||
|
||||
if(mdAzimuthalEqui() && (poly_flags & POLY_INVERSE)) {
|
||||
if(abs(zlevel(pp.V * C0) - 1) < 1e-6) {
|
||||
bool nofill = false;
|
||||
|
||||
if(equi && (poly_flags & POLY_INVERSE)) {
|
||||
if(abs(zlevel(pp.V * C0) - 1) < 1e-6 && !pp.tinf) {
|
||||
// we should fill the other side
|
||||
ld h = atan2(glcoords[0][0], glcoords[0][1]);
|
||||
for(int i=0; i<=360; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user