PDA

View Full Version : Elastic String Simulation



Mordoch Bob
02-26-2002, 09:11 PM
I need to simulate a string which is anchored at one end, which is a constantly moving point. The simulation works, except for a fairly annoying problem, which is that the string grows. As far as I can figure out, what happens is that the dual forces of gravity and the one anchored end pull the nodes apart to the point where they are equally stretched out, making each node more or less stable at some point ten or so times further away from its neighbors. I have used a 2D version of this to simulate water before, and to combat this particular problem I used artificial anchors for each node to keep it in place. However, given that the string is constantly moving, it's not possible to define any point to keep the points on the string. So, is there some method for combatting this that I'm unaware of or is this unavoidable?

rIO
02-27-2002, 01:53 AM
Jeff Lander has some good articles on his web site, give it a look..
www.darwin3d.com/gamedev.htm (http://www.darwin3d.com/gamedev.htm)


hope it helps.

rIO.sK http://www.spinningkids.org/rio

NicholasFrancis
02-27-2002, 02:32 AM
Something else to consider is particle-based physics. They are VERY simple to implement (<50 lines of C code) and great for soft bodies (strings, cloth)...

Check out: http://www.ioi.dk/Homepages/tj/publications/gdc2001.htm

It seems too simple to works, but you can very easily have clothes hanging out to dry on a wire - and have everything react in plausible way to collisions.

marcus256
02-27-2002, 02:34 AM
I'm not sure - but isn't that what you would expect? At least if you string has mass. I did a similar simulation (one point was fixed, controlled by the mouse), and I managed to visualize what was going on by assigning different colors to each node. That way I could see how the nodes in the upper part of the string were separated by a larger distance than the nodes in the lower part of the string (i.e. the entire mass of the string pulls the upper part of the string, while very little or no mass pulls the lower part of the string).

You should not insert any artificial anchors - accept the way strings work. If you need a string with "constant" lenght, you need to have very high spring-constants for the node interconnections (which will most likely result in an unstable simulation).

Mordoch Bob
02-27-2002, 12:48 PM
Marcus, you've hit upon my problem exactly. I can make the string less elastic, but in order to keep it exactly in place I have to increase the stiffness so much that the slightest movement will destabilize the string. My problem is that there's a set density of nodes per length that I can fit into the string, which is fairly annoying. It doesn't really matter how I define the desired length, because the actual length is determined by how many nodes there are and how stiff the connection between them is. So, if anyone has an idea how I can force the string to be more dense than it currently is, I'd appreciate you letting me know.

J P
02-27-2002, 03:03 PM
I'm guessing that you're using an explicit integration scheme in your simulation. They are only conditionally stable. An implicit scheme would improve your stability problem.

chrisATI
02-27-2002, 09:52 PM
Originally posted by Mordoch Bob:
I need to simulate a string which is anchored at one end, which is a constantly moving point. The simulation works, except for a fairly annoying problem, which is that the string grows. As far as I can figure out, what happens is that the dual forces of gravity and the one anchored end pull the nodes apart to the point where they are equally stretched out, making each node more or less stable at some point ten or so times further away from its neighbors. I have used a 2D version of this to simulate water before, and to combat this particular problem I used artificial anchors for each node to keep it in place. However, given that the string is constantly moving, it's not possible to define any point to keep the points on the string. So, is there some method for combatting this that I'm unaware of or is this unavoidable?
You may find this paper useful in solving your problem:

Physically Based Modeling: Principles and Practice (Online Siggraph '97 Course notes): http://www.cs.cmu.edu/afs/cs/user/baraff/www/sigcourse/index.html

The contrained dynamics section should help you a lot. Basically you want the two points to be constrained such that they are always a certain distance apart. This is a very nice algorithm because it enables you to define and "plug-in" different kinds of contraints (not just distance constraints). When I was in college we used this technique to write a constrained based animation demo, the webpage with each student's results is still online:
http://caslab.bu.edu/course/cs580-Fall1999/p3.html

Perhaps you can find something useful there.



[This message has been edited by chrisATI (edited 02-27-2002).]