Jump to content
  • Advertisement
Sign in to follow this  
daniel_i_l

implementing semi implicit euler

This topic is 3493 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently trying to write a general integrator. Most of the material on the web recommends making the integrate function receive a vector of doubles as the state and a function pointer to a "getDerivative" function which the integrator can use to figure out the derivative at some future point in time. This is needed for RK4 for example. So the integrate function looks like: integrate(double[] initial, double[] final, time t0, time t1, getDerivative) where initial and final are vectors constructed from all the state information (positions, velocities, rotations,...) But I don't understand how this information can be used to implement a semi implicit euler integrator. For the SIEI to work it has to first integrate the velocities and then use those to get the new positions. But if the input is just an array of doubles how does it know which part of the input is the velocity and which is the position? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Does anyone have any ideas?
Does anyone have any information in general about the implementation of a general integrator?
Thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by daniel_i_l
... if the input is just an array of doubles how does it know which part of the input is the velocity and which is the position?
Thanks.


Hi Daniel,

Rather than simply feeding the integration function with an array, I'd give it a predefined struct with clearly defined position, velocity, and force vectors, like this particle struct I use for various different simulation purposes.


// point mass structure
struct PointMass
{
float mass; // mass
float radius; // radius
vec2f frc; // force vector
vec2f acc; // accelleration vector
vec2f vel; // velocity vector
vec2f psn; // position vector
};


Although I'm not using the integration method you request, you may find it useful to look at this example (c++ source code + exe).

http://www.jernmager.dk/stuff/cpp/softbody_glfw.zip

Don't know if I can be of more help...

Cheers & gl,
Mike

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!