Post Reply 
Casio Python updates
04-09-2020, 12:03 AM (This post was last modified: 04-09-2020 12:06 AM by ijabbott.)
Post: #6
RE: Casio Python updates
(04-08-2020 09:37 PM)toml_12953 Wrote:  
(04-08-2020 08:44 PM)ijabbott Wrote:  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()

You don't want to see it drawn? Smile

It still shows it being drawn, but a whole section at a time (including hidden line removal) instead of a single point at a time. The main speed increase comes from only blanking 10 pixels below the curve for hidden line removal instead of blanking all the way to the bottom.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Casio Python updates - ijabbott - 04-07-2020, 08:19 PM
RE: Casio Python updates - toml_12953 - 04-08-2020, 02:53 AM
RE: Casio Python updates - ijabbott - 04-08-2020, 08:44 PM
RE: Casio Python updates - toml_12953 - 04-08-2020, 09:37 PM
RE: Casio Python updates - ijabbott - 04-09-2020 12:03 AM
RE: Casio Python updates - toml_12953 - 04-11-2020, 04:09 PM
RE: Casio Python updates - Helix - 04-08-2020, 10:40 PM
RE: Casio Python updates - toml_12953 - 04-09-2020, 12:15 AM
RE: Casio Python updates - ijabbott - 04-09-2020, 12:35 AM
RE: Casio Python updates - toml_12953 - 04-09-2020, 12:54 AM
RE: Casio Python updates - StephenG1CMZ - 04-11-2020, 03:40 PM
RE: Casio Python updates - toml_12953 - 04-11-2020, 04:31 PM
RE: Casio Python updates - StephenG1CMZ - 04-11-2020, 07:31 PM
RE: Casio Python updates - toml_12953 - 04-11-2020, 08:38 PM
RE: Casio Python updates - toml_12953 - 04-12-2020, 03:53 PM
RE: Casio Python updates - toml_12953 - 01-24-2021, 12:51 PM
RE: Casio Python updates - StephenG1CMZ - 01-24-2021, 03:22 PM
RE: Casio Python updates - critor - 01-26-2021, 07:20 PM
RE: Casio Python updates - robve - 02-13-2021, 06:27 PM
RE: Casio Python updates - robve - 02-14-2021, 03:00 AM



User(s) browsing this thread: 1 Guest(s)