determinate: is point on line segment
问题 I am trying to code an java methods wich returns an boolean true if a point(x,y) is on a line segment and false if not. I tried this: public static boolean OnDistance(MyLocation a, MyLocation b, MyLocation queryPoint) { double value = java.lang.Math.signum((a.mLongitude - b.mLongitude) * (queryPoint.mLatitude - a.mLatitude) - (b.mLatitude - a.mLatitude) * (queryPoint.mLongitude - a.mLongitude)); double compare = 1; if (value == compare) { return true; } return false; } but it doesnt work.