mirror of
https://github.com/csharpee/Map-Projections.git
synced 2025-12-17 00:00:19 -05:00
That's not how you integrate polynomials!
I was able to get the Bat projection working without too much trouble. It turned out that while I got my MacLaurin series right for the conformal mapping from the disc to a hexagon, my integral was wrong. I fixed that, but I still needed to do tho oblique trick to make it look good enough. All in all, it works great. Now I just need an inverse. Newton-Raphson, anyone?
This commit is contained in:
parent
c13f1a2608
commit
cc6d7fcddf
@ -87,9 +87,7 @@ public class MapDesignerVector extends MapApplication {
|
||||
public void start(Stage root) {
|
||||
super.start(root);
|
||||
new Thread(() -> {
|
||||
System.out.println("Check 0");
|
||||
setInput(new File("input/Basic.svg")); //this automatically updates the map
|
||||
System.out.println("Check 1");
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
@ -105,11 +105,25 @@ public class Octohedral {
|
||||
Math.sqrt(3)/2, 0, 0b1000, Property.CONFORMAL, 3, Configuration.BAT_SHAPE) {
|
||||
|
||||
protected double[] faceProject(double lat, double lon) {
|
||||
double[] poleCoords = {lat, lon};
|
||||
double[] vertCoords = obliquifySphc(lat, lon, new double[] {0, Math.PI/4, -3*Math.PI/4}); //look at an oblique aspect from the nearest vertex
|
||||
if (poleCoords[0] > vertCoords[0]) { //if this point is closer to the pole
|
||||
return fortyoctantProject(lat, lon); //project it as normal
|
||||
}
|
||||
else { //if it is closer to the vertex
|
||||
double[] skewCoords = fortyoctantProject(vertCoords[0], vertCoords[1]); //use the maclaurin series centered there
|
||||
return new double[] {
|
||||
-1/2.*skewCoords[0] + Math.sqrt(3)/2*skewCoords[1] + Math.sqrt(3)/2,
|
||||
-Math.sqrt(3)/2*skewCoords[0] - 1/2.*skewCoords[1] + 1/2. };
|
||||
}
|
||||
}
|
||||
|
||||
private double[] fortyoctantProject(double lat, double lon) { //an even finer projection than the half-octant
|
||||
final Complex w = Complex.fromPolar(
|
||||
Math.pow(Math.tan(Math.PI/4-lat/2), 2/3.), lon*2/3.-Math.PI/6);
|
||||
Complex z = w.plus(w.pow(7).divide(3)).plus(w.pow(11).divide(9)).plus(w.pow(13).divide(99/16.));
|
||||
Complex z = w.plus(w.pow(7).divide(21)).plus(w.pow(11).divide(99)).plus(w.pow(13).divide(1287/16.));
|
||||
if (z.isInfinite() || z.isNaN()) z = new Complex(0);
|
||||
z = z.times(new Complex(Math.sqrt(3)/2, 1/2.));
|
||||
z = z.times(new Complex(Math.sqrt(3)/2, 1/2.)).divide(1.112913); //this number is 2^(2/3)/6*\int_0^\pi sin^(-1/3) x dx
|
||||
return new double[] { z.getRe(), z.getIm() };
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user