feat: Implement 'meanProportional' point construction method (#55)
Also fixes a typo in a triple-slash regular expression that was preventing the "quadrilateral" method from being recognized. Completes operation of Joyce's elements through Book VI. Reviewed-on: #55 Co-authored-by: Glen Whitney <glen@studioinfinity.org> Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
parent
a9a5a3584f
commit
f8c95860b8
@ -660,6 +660,13 @@ classHandler: Record<JoyceClass, ClassHandler> :=
|
|||||||
if args.scalar and args.scalar.length
|
if args.scalar and args.scalar.length
|
||||||
callbacks.push (api: AppletObject) =>
|
callbacks.push (api: AppletObject) =>
|
||||||
api.setCoords name, ...vertFlipped(args.scalar or [], cdata)
|
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'
|
'midpoint'
|
||||||
if args.line
|
if args.line
|
||||||
commands.push `${name} = Midpoint(${args.line[0]})`
|
commands.push `${name} = Midpoint(${args.line[0]})`
|
||||||
@ -888,7 +895,7 @@ classHandler: Record<JoyceClass, ClassHandler> :=
|
|||||||
moreParts[0].push newObj
|
moreParts[0].push newObj
|
||||||
api.setVisible newObj, false
|
api.setVisible newObj, false
|
||||||
///triangle|similar|parallelogram|application|quadrilateral
|
///triangle|similar|parallelogram|application|quadrilateral
|
||||||
octagon|pentagon|hexagon///
|
|octagon|pentagon|hexagon///
|
||||||
unless args.subpoints then return
|
unless args.subpoints then return
|
||||||
pt .= args.subpoints
|
pt .= args.subpoints
|
||||||
if method is 'parallelogram'
|
if method is 'parallelogram'
|
||||||
|
Loading…
Reference in New Issue
Block a user