Sign in

    #@totto2727/geo/robust

    totto2727/geo/robust owns orientation and incircle predicates for topology and triangulation code that must distinguish counter-clockwise, clockwise, collinear, inside-circle, and outside-circle relationships.

    #Usage

    Classify a turn before choosing a topology branch:

    ///|
    test "classify a left turn" {
    let determinant = orient2d(
    @type.Coord(0.0, 0.0),
    @type.Coord(1.0, 0.0),
    @type.Coord(0.0, 1.0),
    )
    @test.assert_eq(determinant > 0.0, true)
    }

    #API

    This README was generated from the share-artifact skill and README template.

    CCWERRBOUND_B

    let CCWERRBOUND_B : Double

    CCWERRBOUND_C

    let CCWERRBOUND_C : Double

    EPSILON

    let EPSILON : Double

    ICCERRBOUND_A

    let ICCERRBOUND_A : Double

    ICCERRBOUND_B

    let ICCERRBOUND_B : Double

    ICCERRBOUND_C

    let ICCERRBOUND_C : Double

    RESULTERRBOUND

    let RESULTERRBOUND : Double

    SPLITTER

    let SPLITTER : Double

    estimate

    fn estimate(e : Array[Double], len : Int) -> Double

    fast_expansion_sum_zeroelim

    fn fast_expansion_sum_zeroelim(e : Array[Double], elen : Int, f : Array[Double], flen : Int) -> Array[Double]

    Shewchuk's "fast expansion sum, zero-elimination" merge of two expansions e[0..elen] and f[0..flen] into a returned expansion of length up to elen + flen. The output array is freshly allocated; the inputs are not mutated.

    §3.12 case 3: the merge body is a measured hot path (called many times per orient2d adaptive step). The local accumulator h is built via push and never escapes — it is returned to the caller as the only reference, so the encapsulated mutation is invisible to the rest of the program.

    fast_two_sum

    fn fast_two_sum(a : Double, b : Double) -> (Double, Double)

    fast_two_sum_tail

    fn fast_two_sum_tail(a : Double, _b : Double, x : Double) -> Double

    incircle

    Returns a positive value if pd lies inside the circle through pa, pb, pc (with the points in CCW order). Negative if outside, zero if cocircular.

    orient2d

    Returns a positive value if pa, pb, pc occur in counter-clockwise order (pc lies to the left of the directed line from pa to pb). Returns a negative value if they occur clockwise. Returns 0 if collinear.

    This is Shewchuk's adaptive precision predicate, robust against floating-point error.

    scale_expansion_zeroelim

    fn scale_expansion_zeroelim(e : Array[Double], elen : Int, b : Double) -> Array[Double]

    Shewchuk's "scale expansion, zero-elimination": multiplies expansion e[0..elen] by scalar b. Returns a freshly allocated expansion; the input is not mutated. Same hot-path justification as fast_expansion_sum_zeroelim.

    split

    fn split(a : Double) -> (Double, Double)

    square

    fn square(a : Double) -> (Double, Double)

    square_tail

    fn square_tail(a : Double, x : Double) -> Double

    two_diff

    fn two_diff(a : Double, b : Double) -> (Double, Double)

    two_diff_tail

    fn two_diff_tail(a : Double, b : Double, x : Double) -> Double

    two_one_diff

    fn two_one_diff(a1 : Double, a0 : Double, b : Double) -> (Double, Double, Double)

    two_one_product

    fn two_one_product(a1 : Double, a0 : Double, b : Double) -> (Double, Double, Double, Double)

    two_one_sum

    fn two_one_sum(a1 : Double, a0 : Double, b : Double) -> (Double, Double, Double)

    two_product

    fn two_product(a : Double, b : Double) -> (Double, Double)

    two_product_presplit

    fn two_product_presplit(a : Double, b : Double, bhi : Double, blo : Double) -> (Double, Double)

    two_sum

    fn two_sum(a : Double, b : Double) -> (Double, Double)

    two_sum_tail

    fn two_sum_tail(a : Double, b : Double, x : Double) -> Double

    two_two_diff

    fn two_two_diff(a1 : Double, a0 : Double, b1 : Double, b0 : Double) -> (Double, Double, Double, Double)

    two_two_sum

    fn two_two_sum(a1 : Double, a0 : Double, b1 : Double, b0 : Double) -> (Double, Double, Double, Double)