private static boolean inSegment(final Point p, final Point segP0, final Point segP1) {
        final int sp0x = segP0.x;
        final int sp1x = segP1.x;

        if (sp0x != sp1x) { // S is not vertical
            final int px = p.x;
            if (sp0x <= px && px <= sp1x) {
                return true;
            }
            return sp0x >= px && px >= sp1x;
        } else { // S is vertical, so test y coordinate
            final int sp0y = segP0.y;
            final int sp1y = segP1.y;
            final int py = p.y;

            if (sp0y <= py && py <= sp1y) {
                return true;
            }
            return sp0y >= py && py >= sp1y;
        }
    }
inSegment(): determine if a point is inside a segment

@param p     a point
@param segP0 starting point of segment
@param segP1 ending point of segment
@return 1 = P is inside S
0 = P is not inside S
main/src/main/java/cgeo/geocaching/brouter/core/OsmNogoPolygon.java