[][src]Function s2::predicates::stable_sign

pub fn stable_sign(a: &Point, b: &Point, c: &Point) -> Direction

stable_sign reports the direction sign of the points in a numerically stable way. Unlike triageSign, this method can usually compute the correct determinant sign even when all three points are as collinear as possible. For example if three points are spaced 1km apart along a random line on the Earth's surface using the nearest representable points, there is only a 0.4% chance that this method will not be able to find the determinant sign. The probability of failure decreases as the points get closer together; if the collinear points are 1 meter apart, the failure rate drops to 0.0004%.

This method could be extended to also handle nearly-antipodal points, but antipodal points are rare in practice so it seems better to simply fall back to exact arithmetic in that case.