Loading ...
Sorry, an error occurred while loading the content.

6120Re: New Newsletter & Include File

Expand Messages
  • tenochtitlanuk
    Jun 9, 2002
    • 0 Attachment
      '> If anyone knows how to plot an ellipse with the major axis on any
      '> angle PLEASE LET ME KNOW!)

      'I thought I'd posted my plays with elipses. Here is one..
      'Try the following, which calls my function in a loop
      ' to generate a nested family-


      nomainwin

      UpperLeftX = 50
      UpperLeftY = 50
      WindowWidth = 700
      WindowHeight = 500

      open "ellipse" for graphics as #main

      print #main, "trapclose [quit]"

      r1 =100
      r2 =200

      PI = 3.14159265

      phi = 35

      col$( 0) ="pink"
      col$( 1) ="black"
      col$( 2) ="red"
      col$( 3) ="green"
      col$( 4) ="blue"
      col$( 5) ="yellow"
      col$( 6) ="cyan"
      col$( 7) ="lightgray"

      for j=0 to 20 step 0.5
      dummy =ellipse( 300, 200, j *20, j *10, 8*rnd(1), j/10)
      next j

      print #main, "flush"
      wait

      [quit]
      close #main
      end

      'define a function for drawing general ellipses
      function ellipse( x, y, r1, r2, col, phi)
      'x, y are position of centre.
      'r1 & r2 are the two semi-axis lengths
      ' col is a colour number so can easily select colour
      ' phi is the rotation of the major axis
      ' PS angles are in radians so 360 degrees is 2 Pi ie 6.28..

      a =r1
      b =0
      xx =x +a *cos( phi) -b *sin( phi)
      yy =y +a *sin( phi) +b *cos( phi)
      print #main, "goto "; str$( xx); " "; str$( yy)
      print #main, "down"
      print #main, "color "; col$( col)

      for theta =0 to 6.28302 step 0.02
      a =r1 *cos( theta)
      b =r2 *sin( theta)
      xx =x +a *cos( phi) -b *sin( phi)
      yy =y +a *sin( phi) +b *cos( phi)
      print #main, "goto "; str$( xx); " "; str$( yy)
      scan
      next theta

      print #main, "up"
      end function
    • Show all 15 messages in this topic