Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TileCoordinate p1_t = GeoCoordToTileCoord(p1_lat, p1_long, zoom);
- TileCoordinate p2_t = GeoCoordToTileCoord(p2_lat, p2_long, zoom);
- CPoint p1;
- p1.x = 256*p1_t.intpartX + p1_t.fractpartX;
- p1.y = 256*p1_t.intpartY + p1_t.fractpartY;
- CPoint p2;
- p2.x = 256*p2_t.intpartX + p2_t.fractpartX;
- p2.y = 256*p2_t.intpartY + p2_t.fractpartY;
- CPoint pIntersect;
- for(double i = p1.x; i < p2.x ; ++i)
- {
- if(i%256 == 0)
- {
- double dy = p2.y-p1.y;
- double p = i/(p2.x-p1.x);
- pIntersect.y = dy*p;
- }
- }
- for(double i = p1.y; i < p2.y ; ++i)
- {
- if(i%256 == 0)
- {
- double dx = p2.x-p1.x;
- double p = i/(p2.y-p1.y);
- pIntersect.x = dx*p;
- }
- }
- //retransform px part to tile coord and add pIntersect
Advertisement
Add Comment
Please, Sign In to add comment