fix: correct handedness of polygon application in some cases (#50)
Resolves #49. Also adds a special-case hack to correct a small error in Joyce's rendition of Book II, Prop 14. (That the error is truly in Joyce's spec rather than adapptlet is shown by the screenshot, which has an incorrect diagram.) With this PR, as far as I know all diagrams in Books I and II work, Reviewed-on: #50 Co-authored-by: Glen Whitney <glen@studioinfinity.org> Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
parent
d024fcfa31
commit
6489fb7fac
3 changed files with 127 additions and 3 deletions
|
@ -583,7 +583,11 @@ classHandler: Record<JoyceClass, ClassHandler> :=
|
|||
commands.push `${name} = Translate(${source}, ${displacement})`
|
||||
'first'
|
||||
unless args.subpoints then return
|
||||
commands.push `${name} = ${args.subpoints[0]}`
|
||||
// HACK: Special-case correction for Joyce Elements Bk II, prop 14
|
||||
index .= 0
|
||||
if name === 'H' and args.line and args.line[0] === 'HH2'
|
||||
index = 1
|
||||
commands.push `${name} = ${args.subpoints[index]}`
|
||||
/fixed|free/
|
||||
unless args.scalar then return
|
||||
coords := vertFlipped(args.scalar, cdata)
|
||||
|
@ -875,10 +879,10 @@ classHandler: Record<JoyceClass, ClassHandler> :=
|
|||
else if method is 'application'
|
||||
unless pt.length is 3 then return
|
||||
unless args.polygon?.length is 1 then return
|
||||
direction := `UnitVector(${pt[0]} - ${pt[2]})`
|
||||
direction := `UnitVector(${pt[2]} - ${pt[0]})`
|
||||
angle := `Angle(${pt[1]},${pt[0]},${pt[2]})`
|
||||
length := `Area(${args.polygon})`
|
||||
+ `/(Distance(${pt[0]},${pt[1]})*sin(${angle}))`
|
||||
+ `/(Distance(${pt[0]},${pt[1]})*abs(sin(${angle})))`
|
||||
commands.push ...[0..1].map (n) =>
|
||||
`${aux}${n} = ${pt[n]} + ${length}*${direction}`
|
||||
auxiliaries.push aux+0, aux+1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue