mirror of
https://github.com/csharpee/Map-Projections.git
synced 2025-12-13 00:00:07 -05:00
watertight polygons
I fixd the polygons! I just had to remove the equal-to-endpoint rule and add a more specific exception for λ=-π.
This commit is contained in:
parent
4675409725
commit
ca0d6de292
@ -443,10 +443,11 @@ public class Elastik {
|
|||||||
for (int i = 1; i < ф_vertices.length; i ++) {
|
for (int i = 1; i < ф_vertices.length; i ++) {
|
||||||
if (abs(λ_vertices[i] - λ_vertices[i - 1]) > PI)
|
if (abs(λ_vertices[i] - λ_vertices[i - 1]) > PI)
|
||||||
continue; // skip edges that are wrapping around the backside
|
continue; // skip edges that are wrapping around the backside
|
||||||
// if our north-south line crosses it
|
|
||||||
if (λ_vertices[i - 1] != λ_vertices[i]) {
|
// see if our north-south line crosses it
|
||||||
if ((λ_vertices[i - 1] < λ) != (λ_vertices[i] < λ) ||
|
boolean crosses = (λ_vertices[i - 1] < λ) != (λ_vertices[i] < λ) ||
|
||||||
λ_vertices[i - 1] == λ || λ_vertices[i] == λ) {
|
(λ == -PI && min(λ_vertices[i - 1], λ_vertices[i]) == -PI);
|
||||||
|
if (crosses) {
|
||||||
// calculate *where* it crosses
|
// calculate *where* it crosses
|
||||||
double ф_intersect;
|
double ф_intersect;
|
||||||
if (ф_vertices[i - 1] != ф_vertices[i]) {
|
if (ф_vertices[i - 1] != ф_vertices[i]) {
|
||||||
@ -467,7 +468,6 @@ public class Elastik {
|
|||||||
crossings -= 1;
|
crossings -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return crossings > 0;
|
return crossings > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -488,7 +488,7 @@ public class Elastik {
|
|||||||
public SplineSurface(double[][] values) {
|
public SplineSurface(double[][] values) {
|
||||||
this.values = values;
|
this.values = values;
|
||||||
|
|
||||||
// set the gradients at the nodes
|
// set the gradients at the nodes to finite-difference estimates
|
||||||
final int m = values.length;
|
final int m = values.length;
|
||||||
final int n = values[0].length;
|
final int n = values[0].length;
|
||||||
this.gradients_dф = new double[m][n];
|
this.gradients_dф = new double[m][n];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user