#### B+

• Full Member
• Posts: 215
« on: September 06, 2016 »
Code: [Select]
`'quad test.txt for Naalaa [B+=MGA] 2016-09-05' try appendage with polygon fill methodconstant:XMAX = 800YMAX = 600hidden:set window 100, 40, 800, 600set redraw offfor a = 0 to 360 set colori 0 cls set color 255, 0, 0 cp = xy2P(400, 300) nextP = quad(cp, 1.0, float(a), 150.0, 50.0) set color 0, 128, 0 nextP = quad(nextP, 1.0, float(a) * 4.0, 75.0, 25.0) set color 0, 0, 255 nextP = quad(nextP, 1.0, float(a) * 16.0, 50.0, 13.0) set color 255, 255, 0 nextP = quad(nextP, 1.0, float(a) * 64.0, 25.0, 7.0) redraw wait 100nextwait keydownfunction quad(pStart, r1#, ang#, lng#, r2#)'solid fill circles at both ends, use polygon 4 points to fill middle area'draws from pStart at radius r1 down angle ang for length of lng'with r2 being the radius at end point 'returns the x, y end point in P form for further pendage drawing'constants XMAX, YMAX'needs fcirc(x, y, r)'needs xy2P(x, y) 'extract x, y start line of circles  fx# = float(pStart % (XMAX + 1)) fy# = float(pStart) / float(XMAX) x1# = fx# + r1# * cos(ang# + 90.0) y1# = fy# + r1# * sin(ang# + 90.0) x2# = fx# + r1# * cos(ang# - 90.0) y2# = fy# + r1# * sin(ang# - 90.0)  xe# = fx# + lng# * cos(ang#)  ye# = fy# + lng# * sin(ang#) x3# = xe# + r2# * cos(ang# + 90.0) y3# = ye# + r2# * sin(ang# + 90.0) x4# = xe# + r2# * cos(ang# - 90.0) y4# = ye# + r2# * sin(ang# - 90.0) _fcirc int(fx#), int(fy#), int(r1#)  _fcirc int(xe#), int(ye#), int(r2#) 'draw quad fill draw poly[int(x1#), int(y1#), int(x2#), int(y2#), int(x4#), int(y4#), int(x3#), int(y3#)], true return xy2P(int(xe#), int(ye#))endfuncprocedure fcirc(x, y, r) rsq = r * r for a = 0 to r b = int(sqr(float(rsq - a * a))) x1 = x + a; x2 = x - a; y1 = y - b; y2 = y + b draw line x1, y1, x1, y2 draw line x2, y1, x2, y2 nextendprocfunction xy2P(x, y) 'note uses constants XMAX screen width return y * (XMAX + 1) + xendfunc`
B+

#### Rick3137

• Sr. Member
• Posts: 347
• May the Force be with You
« Reply #1 on: September 06, 2016 »
Works good.  37 seconds on my computer.

• Full Member
• Posts: 215