Index: src/uk/me/parabola/util/IsInUtil.java
===================================================================
--- src/uk/me/parabola/util/IsInUtil.java	(revision 4492)
+++ src/uk/me/parabola/util/IsInUtil.java	(working copy)
@@ -122,11 +122,11 @@
 									isCrossing = true;
 								} else if (x == IntersectionStatus.JOINING) {
 									if (!isOnOrCloseToEdgeOfShape(shape, p21, p20)) {
-										pTest = p21.makeBetweenPoint(p20, 0.01);
+										pTest = p21.destOnRhumbLine(EPS*1.1, p21.bearingToOnRhumbLine(p20, true));
 									}
 								} else if (x == IntersectionStatus.SPLITTING) {
 									if (!isOnOrCloseToEdgeOfShape(shape, p21, p22)) {
-										pTest = p21.makeBetweenPoint(p22, 0.01);
+										pTest = p21.destOnRhumbLine(EPS*1.1, p21.bearingToOnRhumbLine(p22, true));
 									}
 								}
 								if (pTest != null) {
@@ -359,17 +359,10 @@
 					else
 						latDif = nodeLat - trailLat - (double)(nodeLon - trailLon) / (leadLon - trailLon) * (leadLat - trailLat);
 					// calculate distance to segment using right-angle attitude theorem
-					final double lonDifSqrd = lonDif*lonDif;
-					final double latDifSqrd = latDif*latDif;
 					log.debug("inBox", leadLon-nodeLon, leadLat-nodeLat, trailLon-nodeLon, trailLat-nodeLat, lonDif, latDif, lhsCount, rhsCount);
-					// there a small area between the square EPS_HP*2 and the circle within, where, if polygon vertix and
+					// there is a small area between the square EPS_HP*2 and the circle within, where, if polygon vertex and
 					// segments are the other side, it might still be calculated as ON.
-					if (lonDif == 0)
-						distSqrd = latDifSqrd;
-					else if (latDif == 0)
-						distSqrd = lonDifSqrd;
-					else
-						distSqrd = lonDifSqrd * latDifSqrd / (lonDifSqrd + latDifSqrd);
+					distSqrd = lonDif*lonDif + latDif*latDif; 
 					if (distSqrd < EPS_HP_SQRD)
 						return ON;
 					if ((trailLat <= nodeLat && leadLat >  nodeLat) || //  an upward crossing
