Robust geometric predicates in MoonBit: orient2d of robust-predicates 3.0.3 (Shewchuk's adaptive-precision arithmetic)
moon add t-ujiie-g/robusttest "orient2d" {
// Twice the signed area of the triangle a, b, c; the sign is exact.
assert_true(@robust.orient2d(0, 0, 1, 0, 0, 1) < 0) // counter-clockwise (y up)
assert_true(@robust.orient2d(0, 0, 0, 1, 1, 0) > 0) // clockwise
assert_true(@robust.orient2d(0, 0, 1, 1, 2, 2) == 0) // collinear
}fn orient2d(ax : Double, ay : Double, bx : Double, by : Double, cx : Double, cy : Double) -> DoubleInstall
Download zipRobust geometric predicates in MoonBit: orient2d of robust-predicates 3.0.3 (Shewchuk's adaptive-precision arithmetic)