I wish I knew math like you.
I find that hilarious for a number of reasons:
1. When it came to Calculus I folded up like a hedgehog under attack.
2. The Maths in that stack is so simple that it involves the sort of thing I learnt when I was about 13.
Code: Select all
on mouseUp
put empty into fld "PTZ"
put empty into fld "DEGZ"
set the vis of grc "PP" to true
put 1.57 into ZZ
repeat until ZZ > 4.71
put COS(ZZ) into COZ
put SIN(ZZ) into SIZ
put (SIZ * 100) + 200 into BSIZ
put (COZ * 100) + 200 into BCOZ
put (((ZZ - 1.57) * 100) + 1) into ZZ100
put BSIZ & "," & BCOZ into line ZZ100 of fld "PTZ"
put ((ZZ * 57.325) - 180) into line ZZ100 of fld "DEGZ"
set the points of grc "PP" to fld "PTZ"
add 0.1 to ZZ
end repeat
put fld "ff" into FX
put 21 into LOX
repeat until FX is empty
put the last char of FX into fld "gg"
delete the last char of FX
import snapshot from fld "gg"
put line LOX of fld "PTZ" into XYZ
set the loc of the last control to XYZ
put line LOX of fld "DEGZ" into ABC
set the angle of the last control to ABC
add 30 to LOX
end repeat
set the vis of grc "PP" to false
end mouseUp
While the results may look impressive the maths is really fairly basic: so, for those of you who think I'm a genius
let me disabuse you:
1. First of all I created a Polygon graphic which I named "PP".
All this code does is put a load of points into a scrolling list field and put those points into the points of the graphic "PP":
Code: Select all
put empty into fld "PTZ"
put empty into fld "DEGZ"
set the vis of grc "PP" to true
put 1.57 into ZZ
repeat until ZZ > 4.71
put COS(ZZ) into COZ
put SIN(ZZ) into SIZ
put (SIZ * 100) + 200 into BSIZ
put (COZ * 100) + 200 into BCOZ
put (((ZZ - 1.57) * 100) + 1) into ZZ100
put BSIZ & "," & BCOZ into line ZZ100 of fld "PTZ"
put ((ZZ * 57.325) - 180) into line ZZ100 of fld "DEGZ"
set the points of grc "PP" to fld "PTZ"
add 0.1 to ZZ
end repeat
1.1. It has been set up to make a crescent of points.
1.2. The first trick is to remember that 18 degrees = π radians, and, that as far as Richmond's limited Maths goes π = 3.14.
1.3 The second trick is to remember that the LiveCode developers 'start their clock' as 12 o'clock, and not at
9 o'clock: hence the start at π/2 and the finish at π * 1.5.
2. I took the word out of the field "ff" and popped it into a variable called FX:
3. I started "popping and chopping" letters from the end of FX into the field "gg" and taking snapshots
of those letters in that field:
Code: Select all
put the last char of FX into fld "gg"
delete the last char of FX
import snapshot from fld "gg"
then I moved the resulting snapshots to the points on my crescent:
Code: Select all
set the loc of the last control to XYZ
put line LOX of fld "DEGZ" into ABC
set the angle of the last control to ABC
I derived my angle ABC from working out that 180 / π = 57.325, so I multiplied
the radian value by 57.325 to get the angle value.
NO WAY can anyone describe that as fancy Maths.
