`Just change this equation to build a graph
`Always start with 'y=', and use the x, z, n# variables to create any equation.
`n# is used for animation, it loops "-5 -> +5 -> -5" ...so on
tehequation$="-put in text form so you remember equation during run-"
tehequation:
y=((x*z*x*z)/20*n#)+(((x*x)+(z*z))*n#*-1)
return
`low is the n# minimum, high is the n# maximum
low#=-5.0
high#=5.0
sync on
set window on
hide mouse
cls rgb(255,255,255)
for x=1 to 64
for y=1 to 64
ink rgb(x+y,x+y,x+y),0
dot x,y
next y
next x
get image 1,0,0,64,64
make matrix 1,1000,1000,30,30
prepare matrix texture 1,1,1,1
ghost matrix on 1
position matrix 1,-500,0,-500
make matrix 2,1000,1000,30,30
prepare matrix texture 2,1,1,1
position matrix 2,-500,-2,-500
color backdrop 0
set camera range 1,1000000
do
if curve=0
text 10,5,tehequation$+" : no curve n#"
else
text 10,5,tehequation$+" : sine curve n#"
endif
text 10,20,"n="+str$(low#)+" -> "+str$(high#)
text 10,35,"n="+str$(n#)
for z=-15 to 15
for x=-15 to 15
gosub tehequation
set matrix height 1,x+15,z+15,y
set matrix height 2,x+15,z+15,y
next x
next z
normalize(1):normalize(2)
update matrix 1:update matrix 2
if dire=0 then inc n#,0.05 else dec n#,0.05
if n#>high# then dire=1:n#=high#-0.05
if n#<low# then dire=0:n#=low#+0.05
if controlkey()=1 then inc dist#,20
if shiftkey()=1 then inc dist#,-20
if leftkey()=1 then ya#=wrapvalue(ya#-3)
if rightkey()=1 then ya#=wrapvalue(ya#+3)
if upkey()=1 then xa#=wrapvalue(xa#-8)
if downkey()=1 then xa#=wrapvalue(xa#+8)
if spacekey()=0 then sp=0
if spacekey()=1 and sp=0
if curve=0 then curve=1 else curve=0
sp=1
endif
if dist#<100 then dist#=100
position camera newxvalue(0,ya#,dist#),newyvalue(0,xa#,dist#),newzvalue(0,ya#,dist#)
point camera 0,0,0
sync
loop
function normalize(mtx_number)
for z_normal=1 to 30
for x_normal=1 to 30
height_8#=get matrix height(mtx_number,x_normal,z_normal-1)
height_4#=get matrix height(mtx_number,x_normal-1,z_normal)
height_0#=get matrix height(mtx_number,x_normal,z_normal)
height_2#=get matrix height(mtx_number,x_normal,z_normal)
x1#=(x_normal-1)*25.0:y1#=height_0#
x2#=(x_normal+0)*25.0:y2#=height_4#
dx#=x2#-x1# : dy# = y2#-y1#
ax#=atanfull(dx#,dy#)
ax#=wrapvalue(90-ax#)
z1#=(z_normal-1)*25.0:y1#=height_2#
z2#=(z_normal+0)*25.0:y2#=height_8#
dz#=z2#-z1#:dy#=y2#-y1#
az#=atanfull(dz#,dy#)
az#=wrapvalue(90-az#)
nx#=sin(ax#):ny#=COS(ax#):nz#=sin(az#)
set matrix normal mtx_number,x_normal,z_normal,nx#,ny#,nz#
next x_normal
next z_normal
endfunction
Well its not exactly a calc, but it does the graphs!
It aint finished but it works. Ill eventually put in a thing to unravel an inputted equation, and make it use sine or curvevalue to animate the n#. Test it out.