Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
plz help (drawing a polygon)
#11
if someone would help me with the slant, too..
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#12
here it goes:

Code:
SCREEN 13
CONST pi = 3.131592
CONST pi180 = 3.145192 / 180
start.x% = 140
start.y% = 100
poly.width% = 20
poly.sides% = 12
poly.slant% = 45 'degrees
slant.sin = SIN(poly.slant% * pi180)
slant.cos = COS(poly.slant% * pi180)
cur.x% = 0
cur.y% = 0
scr.x% = cur.x% + slant.sin * cur.y%
scr.y% = slant.cos * cur.y%
PSET (scr.x% + start.x%, scr.y% + start.y%)
t3 = 0
t2 = 2 * pi / poly.sides%
FOR i% = 1 TO poly.sides%
  cur.x% = cur.x% + SIN(t3) * poly.width%
  cur.y% = cur.y% + COS(t3) * poly.width%
  scr.x% = cur.x% + slant.sin * cur.y%
  scr.y% = slant.cos * cur.y%
  LINE -(scr.x% + start.x%, scr.y% + start.y%), 15
  t3 = t3 + t2
NEXT i%
Antoni
Reply
#13
gee whiz golly, thanks! now i can replace those silly circles withh polygons for my selection draw routines in my game!
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)