commit bdc7588060bb97d9c24061b8c0b408011085e257 Author: Kelvin Sherlock Date: Sat Dec 18 17:15:15 2021 -0500 initial check in. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..28c5d94 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ + +tree.basic : tree.mdbasic + mdbasic++ -o tree.basic tree.mdbasic + +tree.applesoft : tree.mdbasic + mdbasic++ -S tree.mdbasic | tr -d ' ' > tree.applesoft + diff --git a/tree.applesoft b/tree.applesoft new file mode 100644 index 0000000..13e66c5 --- /dev/null +++ b/tree.applesoft @@ -0,0 +1,3 @@ +1A=2:B=-3:C=3.14159:D=1/(2*C):E=D/3:HOME:HGR2:F=0:HCOLOR=1:FORG=0TO14STEP.1:GOSUB2:NEXT:F=C:HCOLOR=5:FORG=0TO14STEP.1:GOSUB2:NEXT:END +2H=G+F:I=G*E:J=I*COS(H):K=-I*SIN(H):L=D*G:K=K-B:IFK<2.9THENRETURN +3J=INT(140+180*(J/K)):L=INT(160+230*((L-A)/K)):HPLOTJ,L:RETURN diff --git a/tree.mdbasic b/tree.mdbasic new file mode 100644 index 0000000..b5473ba --- /dev/null +++ b/tree.mdbasic @@ -0,0 +1,73 @@ +' +' Christmas tree. +' See https://github.com/anvaka/atree for explanation. +' + + +#define yScreenOffset 160 +#define xScreenOffset 140 +#define yScreenScale 230 ' 192 +#define xScreenScale 180 + + yCamera = 2 + zCamera = -3 + + pi = 3.14159 + 'pi4 = pi/4 + + rate = 1 / (2 * pi) + factor = rate/3 + + 'minx=100 + 'max=0 + 'miny=100 + 'maxy=0 + + + home + hgr2 + + 'theta = 0 + angleOffset = 0 + hcolor 1 ' green + for theta=0 to 14 step .1 + gosub update + next + + + + 'theta = 0 + angleOffset = pi + hcolor 5 ' orange + for theta=0 to 14 step .1 + gosub update + next + + 'print "x=";minx;"..";maxx + 'print "y=";miny;"..";maxy + end + + + + +update: + ta = theta + angleOffset + tf = theta * factor + x = tf * cos(ta) 'theta + angleOffset + z = - tf * sin(ta) 'theta + angleOffset + y = rate * theta + + + 'if x>maxx then maxx=x + 'if y>maxy then maxy=y + 'if x