mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 16:35:40 +02:00
Polygon shards (#105)
* Put all of this back in geometry.cpp for conflict resolution * Stabilize line simplification to behave the same regardless of winding * Round instead of truncating when clipping lines * Restore non-Wagyu polygon clipping from prior to2fdec7d2* Make it round, not truncate, which reverts the last commit's test diffs * Clip in floating point, not integers, which makes no difference * Track nodes added at tile edges during clipping * Scale geometry up before wagyu to prevent changes from precision loss * Actually do the shared edge detection * Fix cases where nodes were not being added at the tile boundary * One more place I should have rounded * Narrow down where the discrepancy comes in * Revert "Narrow down where the discrepancy comes in" This reverts commit 221c4c5fc0ac9a6567e091c6a94b3d87dc8ade83. * Another attempt to narrow it down * The discrepancy seems to be introduced in reordering. No obvious bug * Was still truncating instead of rounding in projection * Also makes no difference... * Just forget that line reversal exists for a minute * Just reversal no coalescing * Try clipping in integers instead of floating point * Don't simplify after coalescing if they said no simplification * Check whether behavior is consistent with intentional simplification * Replace more floating point with integer * Are these three features enough to demonstrate the problem? * Add a few more nearby borders * All the features that touch tile 6/16/23 * Stay in integers in line simplification * More attempts to solve failures to simplify consistently * Fix most of the overflow errors * Fix known cases of integer overflow * All the tests change again * Pull clipping and scaling code back out into clip.cpp * Resolve the test conflicts * Stabilize choice of which three points to keep with different windings * Almost right, I think! * Fix collapse of islands to shards * Self-intersections in the same feature don't count * Revert "Self-intersections in the same feature don't count" This reverts commite04b19916e. * Don't scale down geometry if we are going to look for shared nodes * Fix the missing multiply that was keeping simplification from happening * Fix one more opportunity for overflow * Somehow I deleted this test? * Lost this test too * Clean up debugging printfs * Restore code sequence from main to make it reviewable * Remove unneeded rounding * Update documentation * This test is no longer useful * Back to floating point Douglas-Peucker to fix undersimplification * Try an older ubuntu * Revert "Try an older ubuntu" This reverts commit13fefacfd7. * Log OS info * Remove tests that are no longer needed * Oops, did need that one after all * Fix the arm vs x86 discrepancy? * Try another quantization * Cleanup from review * Add a test for the actual purpose of this PR
This commit is contained in:
+4
-4
@@ -57,8 +57,8 @@ void lonlat2tile(double lon, double lat, int zoom, long long *x, long long *y) {
|
||||
double lat_rad = lat * M_PI / 180;
|
||||
unsigned long long n = 1LL << zoom;
|
||||
|
||||
long long llx = n * ((lon + 180) / 360);
|
||||
long long lly = n * (1 - (log(tan(lat_rad) + 1 / cos(lat_rad)) / M_PI)) / 2;
|
||||
long long llx = std::round(n * ((lon + 180) / 360));
|
||||
long long lly = std::round(n * (1 - (log(tan(lat_rad) + 1 / cos(lat_rad)) / M_PI)) / 2);
|
||||
|
||||
*x = llx;
|
||||
*y = lly;
|
||||
@@ -84,8 +84,8 @@ void epsg3857totile(double ix, double iy, int zoom, long long *x, long long *y)
|
||||
ix = 40000000.0;
|
||||
}
|
||||
|
||||
*x = ix * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31);
|
||||
*y = ((1LL << 32) - 1) - (iy * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31));
|
||||
*x = std::round(ix * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31));
|
||||
*y = std::round(((1LL << 32) - 1) - (iy * (1LL << 31) / 6378137.0 / M_PI + (1LL << 31)));
|
||||
|
||||
if (zoom != 0) {
|
||||
*x = std::round((double) *x / (1LL << (32 - zoom)));
|
||||
|
||||
Reference in New Issue
Block a user