From 8e691a56becfb8207aa11f4a9636f0977e657b1a Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Wed, 17 Jan 2024 21:53:45 -0800 Subject: [PATCH] feat: Implement 'meanProportional' point construction method Also fixes a typo in a triple-slash regular expression that was preventing the "quadrilateral" method from being recognized. --- src/adapptlet.civet | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/adapptlet.civet b/src/adapptlet.civet index 65fe4ee..5b2840e 100644 --- a/src/adapptlet.civet +++ b/src/adapptlet.civet @@ -660,6 +660,13 @@ classHandler: Record := if args.scalar and args.scalar.length callbacks.push (api: AppletObject) => api.setCoords name, ...vertFlipped(args.scalar or [], cdata) + 'meanProportional' + pt := args.subpoints + unless pt and pt.length is 6 then return + direction := `UnitVector(Vector(${pt[4]},${pt[5]}))` + lensq := `Distance(${pt[0]},${pt[1]})*Distance(${pt[2]},${pt[3]})` + disp := `sqrt(${lensq})*${direction}` + commands.push `${name} = Translate(${pt[4]},${disp})` 'midpoint' if args.line commands.push `${name} = Midpoint(${args.line[0]})` @@ -888,7 +895,7 @@ classHandler: Record := moreParts[0].push newObj api.setVisible newObj, false ///triangle|similar|parallelogram|application|quadrilateral - octagon|pentagon|hexagon/// + |octagon|pentagon|hexagon/// unless args.subpoints then return pt .= args.subpoints if method is 'parallelogram' -- 2.34.1