Results 1 to 10 of 10
Like Tree1Likes
  • 1 Post By JosAH

Thread: circular movement

  1. #1
    vastrolorde is offline Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Rep Power
    0

    Default circular movement

    Is there a efficient way to control ciruclar movement using acceleration instead of calculating every coordinate manually? And the radius fluctuation stays under 2 pixels, if possible?

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,663
    Blog Entries
    7
    Rep Power
    21

    Default Re: circular movement

    Google for "Bresenham circle"; it is an extremely efficient circle drawing algoritm that takes n steps where n is the number of pixels on the circle.

    kind regards,

    Jos
    MR bruto likes this.
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,786
    Rep Power
    5

    Default Re: circular movement

    One of the rewards of participating in a forum. I never heard of the "Bresenham circle." Now I have something else to read about.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  4. #4
    vastrolorde is offline Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Rep Power
    0

    Default Re: circular movement

    Yes, it seems quite interesting. But does it work with 500 point in different radiuses atthe same time ? The end product should be: point spawns somewhere on the screen. point starts moving towards the given mid point. after reaching certain distance from the midpoint, the point smoothly converts its linear movement towards the middle into circular movement around the midpoint.

    And this tyoe of movement should work with eatch of the 500 point and all the point orbit around the midpoint with different radiuses.

  5. #5
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,663
    Blog Entries
    7
    Rep Power
    21

    Default Re: circular movement

    Congratuations, you have just changed the problem requirements; what you describe now isn't a circular movement, it's a spiral; maybe google can be of further help.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    vastrolorde is offline Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Rep Power
    0

    Default Re: circular movement

    It is not a spiral, it will never reach the midpoint it just keeps its distance from the midpoint. I can use Bresenham circle in hte secondpart of the movement, but the first part needs to be something else. I would show you the picture of whati mean, but unfortunatle the upload image function in this forum doesent work for me.

  7. #7
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,663
    Blog Entries
    7
    Rep Power
    21

    Default Re: circular movement

    Quote Originally Posted by vastrolorde View Post
    It is not a spiral, it will never reach the midpoint it just keeps its distance from the midpoint. I can use Bresenham circle in hte secondpart of the movement, but the first part needs to be something else. I would show you the picture of whati mean, but unfortunatle the upload image function in this forum doesent work for me.
    You hve to describe that 'something else' in much greater detail ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  8. #8
    vastrolorde is offline Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Rep Power
    0

    Default Re: circular movement

    Ok ill try.
    Step 1: Particle is generated
    Step 2: Particle starts moving straight towards the middle point
    Step 3: After reaching Radius + X pixels away from the midpoint particle trajectory starts to curve
    Step 4: Curvature ends when particle reaches Radius pixels from midpoint
    Step 5: From thispoint onward i can use Bresenham circle

    The problematic spot is Step 3 and Step 4. I want the particle to go smoothli into the orbit. Well the number 6 and number 9 somewhat reseble the trajectory im wanting.

  9. #9
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,663
    Blog Entries
    7
    Rep Power
    21

    Default Re: circular movement

    In other words: let the centre of the circle be at (0,0) and the particle is moving downwards; it is moving in the same direction as the radius 'r' from (0,r) to (0,0); at a location (0, r+x) it has to change its direction (suppose it starts moving to the right and downwards) such that when the distance of the particle to the centre equals r, it has to have a direction perpendicular to the radius r at a point (x,y); so its direction should be -x/y (or x/-y) where x^2+y^2 == r^2; hm, my guess would be a discretization of a differential equation ...

    I'll keep it in the back of my head ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  10. #10
    vastrolorde is offline Senior Member
    Join Date
    Jan 2013
    Posts
    124
    Rep Power
    0

    Default Re: circular movement

    discretization of a differential equation i understood most of what you said but when you said "discretization of a differential equation" you lost me.

Similar Threads

  1. Replies: 2
    Last Post: 03-10-2012, 05:26 AM
  2. Circular/Round Button
    By Dilwar in forum AWT / Swing
    Replies: 1
    Last Post: 10-23-2011, 10:28 AM
  3. Java 3D circular movement?
    By AXELTOPOLINO in forum Advanced Java
    Replies: 7
    Last Post: 08-12-2011, 05:31 PM
  4. CIrcular Arrays
    By Bgreen7887 in forum New To Java
    Replies: 1
    Last Post: 03-25-2011, 08:30 AM
  5. Need help with circular arrays
    By bap2 in forum New To Java
    Replies: 6
    Last Post: 11-04-2010, 09:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •