(04-08-2020 02:53 AM)toml_12953 Wrote: Here's an example of the new drawing functions on the fx-CG50:
Code:
from math import *
from casioplot import *
def hat():
p=192; q=100
xp=144; xr=1.5*3.1415927
yp=56; yr=1; zp=64
xf=xr/xp; yf=yp/yr; zf=xr/zp
for y in range(0,192):
for x in range(0,384):
set_pixel(x,y)
for zi in range(-q,q):
if zi>=-zp and zi<=zp:
zt=zi*xp/zp; zz=zi
xl=int(.5+sqrt(xp*xp-zt*zt))
for xi in range(-xl,xl+1):
xt=sqrt(xi*xi+zt*zt)*xf; xx=xi
yy=(sin(xt)+.4*sin(3*xt))*yf
x1=int(xx+zz+p)
y1=192-int(yy-zz+q)
set_pixel(x1,y1,(0,255,0))
show_screen()
for m in range(y1+1,192):
set_pixel(x1,m)
It draws the infamous green hat.
Thanks! I got bored waiting for it to finish, so I tweaked it a little bit.
Code:
from math import *
from casioplot import *
def hat():
p=192; q=100
xp=144; xr=1.5*3.1415927
yp=56; yr=1; zp=64
xf=xr/xp; yf=yp/yr; zf=xr/zp
for y in range(0,192):
for x in range(0,384):
set_pixel(x,y)
for zi in range(-q,q):
if zi>=-zp and zi<=zp:
zt=zi*xp/zp; zz=zi
xl=int(.5+sqrt(xp*xp-zt*zt))
for xi in range(-xl,xl+1):
xt=sqrt(xi*xi+zt*zt)*xf; xx=xi
yy=(sin(xt)+.4*sin(3*xt))*yf
x1=int(xx+zz+p)
y1=192-int(yy-zz+q)
set_pixel(x1,y1,(0,255,0))
for m in range(y1+1,y1+10):
set_pixel(x1,m)
show_screen()