Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-cad

Source of release 0.9.2

0.9.2 / src / layout / policy.lucb

## Decide mapped versus cut-chart ownership from exact support coordinates.
## A four-sided topological domain need not have a rectangular support chart.

pub func prefers_clipping(face: BrepFace, s: Surface, edges: const Curve[], flow: const bool[], tolerance: f64) -> bool!:
    # These are exactly the nonplanar supports handled by seed_layout. Periodic
    # spheres/tori still own mapped layouts; do not decouple their rows for a
    # cut-chart strategy that does not exist for those support kinds.
    if s.kind == surface_plane or s.kind == surface_sphere or s.kind == surface_torus: return false
    for use in 0..<face.uses.length:
        let edge = edges[edge_index(face.uses[use])]
        if edge.start == edge.end: return false
        for before in 0..<use:
            if edge_index(face.uses[before]) == edge_index(face.uses[use]): return false
    for use in 0..<face.uses.length:
        if flow[use]: continue
        var uv = [Vector3(),Vector3(),Vector3(),Vector3(),Vector3(),Vector3(),Vector3(),Vector3(),Vector3()]
        var seed = Vector3(0.5,0.5,0.0)
        for at in 0..<(usize)9:
            seed = try chart_parameter(s,try edges[edge_index(face.uses[use])].at((f64)at/8.0),seed,tolerance)
            uv[at] = seed
        let span = uv[8].subtract(uv[0]).length()
        if iso_axis(uv,math.max(1e-9,span*1e-7)) < 0: return true
    # Different parameter speeds alone do not make a smooth seam incompatible.
    return false