Fix a small bug in lat computation in CheapRulerSingleton and update
according to latest master branch.
This commit is contained in:
parent
2591f22348
commit
1a2a1164f9
4 changed files with 8 additions and 9 deletions
|
|
@ -28,9 +28,8 @@ public class OsmNodeNamed extends OsmNode
|
|||
public double distanceWithinRadius(int lon1, int lat1, int lon2, int lat2, double totalSegmentLength) {
|
||||
double[] lonlat2m = CheapRulerSingleton.getLonLatToMeterScales( (lat1 + lat2) >> 1 );
|
||||
|
||||
double realRadius = radius * 110984.;
|
||||
boolean isFirstPointWithinCircle = CheapRulerSingleton.distance(lon1, lat1, ilon, ilat) < realRadius;
|
||||
boolean isLastPointWithinCircle = CheapRulerSingleton.distance(lon2, lat2, ilon, ilat) < realRadius;
|
||||
boolean isFirstPointWithinCircle = CheapRulerSingleton.distance(lon1, lat1, ilon, ilat) < radius;
|
||||
boolean isLastPointWithinCircle = CheapRulerSingleton.distance(lon2, lat2, ilon, ilat) < radius;
|
||||
// First point is within the circle
|
||||
if (isFirstPointWithinCircle) {
|
||||
// Last point is within the circle
|
||||
|
|
@ -62,7 +61,7 @@ public class OsmNodeNamed extends OsmNode
|
|||
double initialToCenter = CheapRulerSingleton.distance(ilon, ilat, lon1, lat1);
|
||||
// Half length of the segment within the circle
|
||||
double halfDistanceWithin = Math.sqrt(
|
||||
realRadius*realRadius - (
|
||||
radius*radius - (
|
||||
initialToCenter*initialToCenter -
|
||||
initialToProject*initialToProject
|
||||
)
|
||||
|
|
|
|||
|
|
@ -426,7 +426,7 @@ public final class RoutingContext
|
|||
|
||||
double dd = Math.sqrt( (dx10*dx10 + dy10*dy10)*(dx21*dx21 + dy21*dy21) );
|
||||
if ( dd == 0. ) { cosangle = 1.; return 0.; }
|
||||
double sinp = (dy10*dy21 - dx10*dx21)/dd;
|
||||
double sinp = (dx10*dy21 - dy10*dx21)/dd;
|
||||
double cosp = (dy10*dy21 + dx10*dx21)/dd;
|
||||
cosangle = cosp;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue