This commit is contained in:
Dennis Luxen 2013-11-19 10:18:59 +01:00
parent 99e9d0d023
commit 733d1384a4

View File

@ -60,10 +60,10 @@ int DouglasPeucker::fastDistance(
const FixedPointCoordinate& segA,
const FixedPointCoordinate& segB
) const {
const int p2x = (segB.lon - segA.lat);
const int p2y = (segB.lon - segA.lat);
const int p2x = (segB.lon - segA.lon);
const int p2y = (segB.lat - segA.lat);
const int something = p2x*p2x + p2y*p2y;
int u = ( 0 == something ? 0 : ((point.lon - segA.lon) * p2x + (point.lat - segA.lat) * p2y) / something);
double u = ( 0 == something ? 0 : ((point.lon - segA.lon) * p2x + (point.lat - segA.lat) * p2y) / something);
if (u > 1) {
u = 1;