better arc?

11 views
Skip to first unread message

John Hanna

unread,
Feb 15, 2022, 7:51:40 AMFeb 15
to tins...@googlegroups.com

Idle thoughts…

I find that the draw_arc(x, y, w, h, sa, aa) function in both TI-Basic and Python is counter-intuitive (a bounding rectangle).

Here’s a ‘better’ arc function based on center/radii like draw_circle(x,y,r):

#================================

from ti_draw import *

#================================

 

def arc(x, y, r1, r2, sa, aa):

  draw_arc(x-r1, y-r2, 2*r1, 2*r2, sa, aa)

#demo:

set_window(-10, 10, -7, 7)

# draw a circle arc centered at (0,0), radius 5, lower half…

arc(0, 0, 5, 5, 0, -180)

 

  • Still uses ‘start angle’ and ‘arcangle’.
  • Can be circular or elliptical

A similar function can be written for fill_arc.

Try it with and without set_window which flips the screen.

 

Be kind,

     John

 

Reply all
Reply to author
Forward
0 new messages