mirror of
https://github.com/csharpee/Map-Projections.git
synced 2025-12-12 00:00:17 -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 ++) {
|
||||
if (abs(λ_vertices[i] - λ_vertices[i - 1]) > PI)
|
||||
continue; // skip edges that are wrapping around the backside
|
||||
// if our north-south line crosses it
|
||||
if (λ_vertices[i - 1] != λ_vertices[i]) {
|
||||
if ((λ_vertices[i - 1] < λ) != (λ_vertices[i] < λ) ||
|
||||
λ_vertices[i - 1] == λ || λ_vertices[i] == λ) {
|
||||
|
||||
// see if our north-south line crosses it
|
||||
boolean crosses = (λ_vertices[i - 1] < λ) != (λ_vertices[i] < λ) ||
|
||||
(λ == -PI && min(λ_vertices[i - 1], λ_vertices[i]) == -PI);
|
||||
if (crosses) {
|
||||
// calculate *where* it crosses
|
||||
double ф_intersect;
|
||||
if (ф_vertices[i - 1] != ф_vertices[i]) {
|
||||
@ -467,7 +468,6 @@ public class Elastik {
|
||||
crossings -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return crossings > 0;
|
||||
}
|
||||
}
|
||||
@ -488,7 +488,7 @@ public class Elastik {
|
||||
public SplineSurface(double[][] 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 n = values[0].length;
|
||||
this.gradients_dф = new double[m][n];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user