diff --git a/src/adapptlet.civet b/src/adapptlet.civet index 010e0fd..e049d75 100644 --- a/src/adapptlet.civet +++ b/src/adapptlet.civet @@ -500,9 +500,26 @@ classHandler: Record := [center, direction] := args.subpoints // Note clockwise 90° rotation (3π/2) confirmed in Joyce source commands.push `${name} = Rotate(${direction}, 3*pi/2, ${center})` - 'proportion' - pt := args.subpoints + /proportion|similar/ + pt .= args.subpoints unless pt then return + // reduce the similar case to general proportion + if method is 'similar' + unless pt.length is 5 then return + sourcePlane .= '' + destPlane .= '' + if is3d + unless args.plane then return + destPlane = `, ${args.plane[0]}` + if args.plane.length > 1 + sourcePlane = `, ${args.plane[1]}` + else + sourcePlane = `, Plane(${pt[2]}, ${pt[3]}, ${pt[4]})` + angle := `Angle(${pt[3]}, ${pt[2]}, ${pt[4]}${sourcePlane})` + commands.push + `${aux} = Rotate(${pt[1]}, ${angle}, ${pt[0]}${destPlane})` + auxiliaries.push aux + pt = [pt[2], pt[3], pt[2], pt[4], pt[0], pt[1], pt[0], aux] len := `Distance(${pt[2]},${pt[3]})*Distance(${pt[4]},${pt[5]})` + `/ Distance(${pt[0]},${pt[1]})` direction := `UnitVector(Vector(${pt[6]}, ${pt[7]}))`