Sign in to follow this  
too_many_stars

spiral physics help

Recommended Posts

Hello Everyone,

 

Wondering if anyone has some ideas for me. This is also for 2D. Given a circle C(pos,r) I would like to drop a particle of arbitrary mass in, and watch it spiral towards the center.

 

I suspect I can use the Logarithmic Spiral to solve this problem, for example from here http://mathworld.wolfram.com/LogarithmicSpiral.html

 

However, it's position based. What I need is a directional force proportional to the distance from the center. So as the particle gets closer and closer to the center, the force increases.

 

Any sources or ideas would be much appraciated.

 

Thanks in advance,

 

Mike

 

 

Share this post


Link to post
Share on other sites

Any attractive force will cause the particle to fall in a spiral, ending in contact instead of an orbit at some distance if there is attrition. Attrition makes the particle lose energy, until it has no potential energy and it reaches the attractor.

With a constant force towards the spiral center plus a constant force opposite the current velocity vector you cannot go wrong.

Share this post


Link to post
Share on other sites

I am not sure I understand what the problem is with it being "position based". Do you mean that you need to come up with a field of accelerations --not velocities-- that will produce spirals?

 

Hi Alvaro,

 

Yes, I am looking for F=ma => a=F/m. I know the mass, but I don't know how to calculate the Force vector which of course needs a normalized direction and a magnitude for a spiral.

 

Thanks,

 

Mike

Share this post


Link to post
Share on other sites
Well, you could try with something like (-x/(x^2+y^2), -y/(x^2+y^2)), but you also need to add linear drag to your equations of movement, or you will just get periodic orbits.

It you are dropping particles with some angular momentum, they will spiral. If you want the field to add the angular momentum, you can add something proportional to (y, -x). I would try that, that divided by distance to the origin, and that divided by distance to the origin squared, all of them multiplied by various constants. But I don't know what effect you are looking for exactly, so you'll have to play around with it yourself.

Share this post


Link to post
Share on other sites

Just for the record, potential energy is turned into kinetic energy. Energy isn't lost, just converted.

 

Edit: It seems that you want F related to gravitation and do numerical integration. Or do you want to do it parametrically?

Edited by sjhalayka

Share this post


Link to post
Share on other sites

In main.cpp, replace idle_func with the following code. This implements drag:

void idle_func(void)
{
    custom_math::vector_3 grav_dir = sun_pos - mercury_pos;
    custom_math::vector_3 drag_dir = -mercury_vel;
    
    float distance = grav_dir.length();
 
    grav_dir.normalize();
    custom_math::vector_3 accel = grav_dir*(G*sun_mass/pow(distance, 2.0));
    
    drag_dir.normalize();
    accel = accel + drag_dir*(G*sun_mass/pow(distance, 2.1));
    
    float dt = 10000;
 
    mercury_vel = mercury_vel + accel*dt;
    mercury_pos = mercury_pos + mercury_vel*dt;
    
    positions.push_back(mercury_pos);
    
    glutPostRedisplay();
}
Edited by sjhalayka

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this