Ship shared projects and CAD reliability updates

This commit is contained in:
Formsmith
2026-07-19 15:58:52 +03:00
parent 3a7db063e7
commit c5ce5a80f0
23 changed files with 999 additions and 83 deletions
+12
View File
@@ -5,6 +5,7 @@ import {
cleanNearZero,
cleanRotationDegrees,
fallbackSolidColor,
meshYawDegrees,
mirroredAxisCount,
mirrorSign,
normalizeDegrees,
@@ -50,6 +51,17 @@ describe("workplane shape helpers", () => {
expect(cleanRotationDegrees(12.34)).toBe(12.3);
});
it("preserves the meaningful yaw of low-sided circular primitives", () => {
const triangularPrism = shape({ kind: "cylinder", width: 10, depth: 10, sides: 3 });
expect(meshYawDegrees({ ...triangularPrism, rotation: 30 })).toBeCloseTo(30);
expect(meshYawDegrees({ ...triangularPrism, rotation: 150 })).toBeCloseTo(30);
expect(meshYawDegrees({ ...triangularPrism, rotation: 90 })).toBeCloseTo(-30);
expect(meshYawDegrees({ ...triangularPrism, width: 12, rotation: 150 })).toBe(150);
expect(meshYawDegrees({ ...triangularPrism, kind: "box", rotation: 30 })).toBe(30);
expect(meshYawDegrees({ ...triangularPrism, sides: 96, rotation: 90 })).toBe(0);
});
it("cleans near-zero values and derives dimensions", () => {
const base = shape({ size: 30, width: 18, depth: 24 });
expect(cleanNearZero(0.004)).toBe(0);