Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-cad

Source of release 0.9.3

0.9.3 / src / polygons / trim_grid.lucb

## Grid-first trimmed polygon meshing (TrimGrid): trim loops cut by a
## lattice of cells in their chart.

## Grid-first trimmed polygon meshing with pre-split shared boundaries.
pub struct TrimGrid:
    let reserved: u8 = 0

    pub static func clip(points: const Vector3[], sizes: const i64[], us: const f64[], vs: const f64[]) -> interop.Reference[Mesh]!:
        var empty: i64[1]
        return try cut_grid(points, sizes, us, vs, empty[..<0])

    ## As clip(), with explicit shared-vertex identities for pinched CAD loops.
    ## Equal positions alone never identify vertices; output point order stays
    ## unchanged, and polygon corners reference each identity's first occurrence.
    pub static func clip_identified(points: const Vector3[], sizes: const i64[], us: const f64[], vs: const f64[], identities: const i64[]) -> interop.Reference[Mesh]!:
        return try cut_grid(points, sizes, us, vs, identities)