Advertisement
alikimoko

Circle, elipse and Lissajous creation tool

Jul 12th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2. //By ajusting these pareters you can create more round circles that the standard circle fucttion.
  3. //You can also make elipses and Lissajous figures.
  4.  
  5. corners = 360; //Increse for larger figures.
  6. x_centre = room_width/2; //X-coordinate of the centre.
  7. y_centre = room_height/2; //Y-coordinate of the centre.
  8. x_amplitude = 300; //How far on the x-axis goes the figure from the centre.
  9. y_amplitude = 300; //How far on the y-axis goes the figure from the centre.
  10. x_rotations_per_cycle = 1; //How often does the figure go across the x-axis per cycle. Do not set to 0. Using an even number results in an open figure.
  11. y_rotations_per_cycle = 1; //How often does the figure go across the y-axis per cycle. Do not set to 0. Same ratios give the same figure.
  12. x_period = 0; //Does the figure begin at the far right and go left (0) or somewhere else (below 2*pi).
  13. y_period = 0; //Does the figure start at the centre (0) or somewhere else (below 2*pi).
  14. y_direction = -1; //At the beginning, does the figure go up (-1) or down (1).
  15. thickness = 2; //The tickness of the outline.
  16.  
  17. for(i=1; i<(x_rotations_per_cycle*y_rotations_per_cycle*corners); i=i+1){
  18. draw_line_width(x_centre+x_amplitude*cos(x_rotations_per_cycle*(x_period + 2*pi)*(i/(x_rotations_per_cycle*y_rotations_per_cycle*corners))), y_centre+y_amplitude*y_direction*sin(y_rotations_per_cycle*(y_period + 2*pi)*(i/(x_rotations_per_cycle*y_rotations_per_cycle*corners))), x_centre+x_amplitude*cos(x_rotations_per_cycle*(x_period + 2*pi)*((i+1)/(x_rotations_per_cycle*y_rotations_per_cycle*corners))), y_centre+y_amplitude*y_direction*sin(y_rotations_per_cycle*(y_period + 2*pi)*((i+1)/(x_rotations_per_cycle*y_rotations_per_cycle*corners))), thickness);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement