Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-cad

Source of release 0.9.3

0.9.3 / tests / regressions / tangent_trim_tests.luc

## A trim circle tangent to grid lines: a 4x2 plate with an r=0.5 hole at
## (1,1) meshed at 32 divisions puts regular stations exactly on the circle's
## extremes. The fitted circle passes a few ULPs either side of those lines;
## the mesher must neither cut a sub-tolerance cap nor leave a gap sliver, at
## any part scale (millimetre parts to metre parts mesh alike).
from luce_cad.modeling import CadModeling
from luce_geocore.geocore import GeometrySet, Mesh, Sketches, Vector3
from checks import manifold

pub func tangent_trim_tests() -> unit!:
    for scale in [0.1, 1.0, 10.0, 100.0]:
        for placed in [false, true]:
            let empty = GeometrySet.of_mesh(Mesh.empty())
            let base = Sketches.with_plane(empty, Vector3(), Vector3(0.0, 0.0, 1.0)) if placed else empty
            let rectangle = Sketches.with_shape(base, 4, [4.0 * scale, 2.0 * scale], 2.0 * scale, 1.0 * scale)
            let plate = Sketches.with_shape(rectangle, 3, [0.5 * scale], 1.0 * scale, 1.0 * scale)
            manifold(CadModeling.extruded(plate, scale, 0.0, "e").tessellate(32))
    print("PASS tangent trim circles on grid lines at every scale")