feat: Get all of Rostamian's old pages working #44
@ -257,6 +257,7 @@ function jToG(
|
||||
cmdr.callbacks.push (api: AppletObject) =>
|
||||
for each aux of cmdr.auxiliaries
|
||||
api.setAuxiliary aux, true
|
||||
api.setLabelVisible aux, false
|
||||
api.setVisible aux,false
|
||||
|
||||
// set up the pivot if there is one
|
||||
@ -405,7 +406,6 @@ function pivotListener(slider: string)
|
||||
for each anchor of pd.rotatable
|
||||
relX[anchor] = pd.api.getXcoord(anchor) - pX
|
||||
relY[anchor] = pd.api.getYcoord(anchor) - pY
|
||||
console.log 'Unfixing', anchor, relX[anchor], relY[anchor]
|
||||
pd.api.setFixed anchor, false
|
||||
ct := Math.cos rotation
|
||||
st := Math.sin rotation
|
||||
@ -414,7 +414,6 @@ function pivotListener(slider: string)
|
||||
rY := relY[anchor]*ct + relX[anchor]*st
|
||||
pd.api.setCoords(anchor, rX + pX, rY + pY)
|
||||
if pd.fixed[anchor]
|
||||
console.log 'Re-fixing', anchor, rX, rY
|
||||
pd.api.setFixed anchor, true
|
||||
|
||||
function invisible(cname: string): boolean
|
||||
@ -712,6 +711,41 @@ classHandler: Record<JoyceClass, ClassHandler> :=
|
||||
madeSegment = true
|
||||
else
|
||||
commands.push `${aux}2 = Translate(${oldEnd}, ${aux}1)`
|
||||
'perpendicular'
|
||||
pt := args.subpoints
|
||||
unless pt then return
|
||||
inPlane .= ''
|
||||
if cdata.is3d
|
||||
unless args.plane?.length is 1 then return
|
||||
inPlane = `,${args.plane[0]}`
|
||||
switch pt.length
|
||||
when 2
|
||||
ends[0] = pt[0]
|
||||
ends[1] = aux
|
||||
auxiliaries.push aux
|
||||
if args.line?.length is 1
|
||||
ln := args.line[0]
|
||||
commands.push
|
||||
`${name} = Rotate(${ln}, 3*pi/2, ${pt[0]}${inPlane})`
|
||||
`${aux} = Vertex(${name}, 2)`
|
||||
madeSegment = true
|
||||
else
|
||||
commands.push
|
||||
`${aux} = Rotate(${pt[1]}, 3*pi/2, ${pt[0]}${inPlane})`
|
||||
when 3
|
||||
return // TODO: line perpendicular to plane
|
||||
when 4
|
||||
ends[0] = pt[0]
|
||||
ends[1] = aux + 2
|
||||
auxiliaries.push aux+1, aux+2
|
||||
commands.push
|
||||
`${aux}1 = Rotate(${pt[1]}, 3*pi/2, ${pt[0]}${inPlane})`
|
||||
unitVec := `UnitVector(Vector(${pt[0]}, ${aux}1))`
|
||||
dist := `Distance(${pt[2]}, ${pt[3]})`
|
||||
commands.push
|
||||
`${aux}2 = Translate(${pt[0]}, ${dist}*${unitVec})`
|
||||
else return
|
||||
|
||||
unless madeSegment
|
||||
commands.push `${name} = Segment(${ends[0]},${ends[1]})`
|
||||
callbacks.push (api: AppletObject) => api.setLabelVisible name, true
|
||||
|
Loading…
Reference in New Issue
Block a user