Archmedean Spiral

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MBeckford05
    New Member
    • Mar 2007
    • 7

    Archmedean Spiral

    Hi Everyone,

    I am placed with a problem. How to write a program in Java to produce the Archimeadean Spiral. The progam should look like an Archimedean spiral on the screen.

    Any help in hoe to approach the problem would be greatly appreciated
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    In polar form the spiral is defined as r = a * t where r is the radius and t is
    the angle. The constant a can be any value. The transformation from polar
    coordinates to rectangular coordinates isn't that difficult either.

    So loop over variable t, calculate r and go back again to rectangular coordinates
    (x, y). Draw all points (x, y) or connect consecutive (x, y) points with little lines.
    Hint: when t == 0 the radius r == 0 too and so are both x and y.

    kind regards,

    Jos

    Comment

    • MBeckford05
      New Member
      • Mar 2007
      • 7

      #3
      Originally posted by JosAH
      In polar form the spiral is defined as r = a * t where r is the radius and t is
      the angle. The constant a can be any value. The transformation from polar
      coordinates to rectangular coordinates isn't that difficult either.

      So loop over variable t, calculate r and go back again to rectangular coordinates
      (x, y). Draw all points (x, y) or connect consecutive (x, y) points with little lines.
      Hint: when t == 0 the radius r == 0 too and so are both x and y.

      kind regards,

      Jos

      Thank you ! MBeckford05

      How do you convert the Archimedean Spiral to Java. Has the program been written to solve the problem. I hav looked in on the Internet and Java text books. I wondering are there any pointers since I am new to prgramming.

      Thank You ! MBeckford05

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by MBeckford05
        Thank you ! MBeckford05

        How do you convert the Archimedean Spiral to Java. Has the program been written to solve the problem. I hav looked in on the Internet and Java text books. I wondering are there any pointers since I am new to prgramming.
        There is no one-to-one correspondce between a formula and a Java program.
        Personally I would like to fiddle with the parameter value 'a' as well as the
        step size for 't' and the number of full rotations 'k' where t in [0, k*2*pi]. Then
        I'd like to press a button and: voom, there's the spiral.

        Of course some scaling would be needed, but I think that for t= max, the interval
        [-a*max, a*max] for both x and y would be good enough.

        Give it a try and when you're stuck with some detail come back here and feel
        free to ask.

        kind regards,

        Jos

        ps. programming is not about scavenging google pages and collecting scrapes
        of source code. For a really good program most of the time you have to build
        it yourself from scratch.

        Comment

        Working...