Jump to content


Photo

Draw_circle_steps/draw_polygon


  • Please log in to reply
3 replies to this topic

#1 may0004

may0004

    GMC Member

  • New Member
  • 221 posts

Posted 07 January 2007 - 12:38 AM

i've written 2 more lengthdir based scripts these 2 sripts allow you to draw any polygon or circle

Draw polygon is a simple script that allows any user to draw polygon with 1 line of code, it comes with a biult in (not very accurate with smaller numbers)side restricator which stops the user from drawing sides he won't be able to see, this allows for perfect circle to be drawn
Draw polygon can be downloaded here.

Draw circle steps is a script that allows to to choose the angle which the circle start/ends, the increment and the circle thickness.
This script would be very usefull for complex drawings
Draw circle steps can be downloaded here.

~ may0004

PS : both scripts are below 3KB
  • 0

#2 coolsmile

coolsmile

    Programmer

  • New Member
  • 1346 posts

Posted 08 January 2007 - 02:25 AM

Not bad :o, not many know this but you can also use the function
draw_set_circle_precision()
and then draw_circle()

It will do the same thing :P

Not many know about this function, I accidentally found it out though :(
  • 0

#3 may0004

may0004

    GMC Member

  • New Member
  • 221 posts

Posted 08 January 2007 - 02:32 AM

Not bad , not many know this but you can also use the function
draw_set_circle_precision()
and then draw_circle()

It will do the same thing

Not many know about this function, I accidentally found it out though


not quite in draw circle polygon you can also rotate the polygon
but thanks anyway

~may0004
  • 0

#4 cityscape

cityscape

    GMC Member

  • New Member
  • 62 posts

Posted 09 January 2007 - 02:03 AM

that is REALLY weird. i just made two scripts very similar a few days ago
/*
draws a polygon on the screen with given arguments:
argument0 = x position in room
argument1 = y position in room
argument2 = radius, all points on the polygon will be this amount (in pixels) from the center
argument3 = number of sides (2-360) this will determine the type of polygon to draw. a value of 2 will draw a line.
argument4 = rotation in degrees    
*/
var vara; vara = 0;
  repeat(argument3)
  {
  vara += 360 / argument3; draw_line(argument0+sin(degtorad(vara+90+argument4))*argument2,argument1+cos(degtorad(vara+90+argument4))*argument2,argument0+sin(degtorad(argument4+90+vara-(360/argument3)))*argument2,argument1+cos(degtorad(argument4+90+vara-(360/argument3)))*argument2);
  }


/*
draw_circle_part
arg0 = x
arg1 = y
arg2 = radius
arg3 = rotation(degrees) drawing will start here
arg4 = degrees to draw. 180 will draw half the circle ect...
*/
var vara;
vara = 0;
repeat(argument4)
{
vara += 1; 
draw_line(argument0+sin(degtorad(vara+90+argument3))*argument2,argument1+cos(degtorad(vara+90+argument3))*argument2,argument0+sin(degtorad(argument3+90+vara-(1)))*argument2,argument1+cos(degtorad(argument3+90+vara-(1)))*argument2);
}

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users