Sign up ×

There are 4 moving physical nodes in 3D space. They are paired with two elastic line segments / strings (1 <-> 2; 3 <-> 4).

Part I: How to detect the collision of two segments?

Part II: On the moment of collision, fifth node is created at the intersection point and here you have the force-based graph. 5-th node (bend point) can slide among the strings as in a real world. Given the new coordinates of 4 nodes, how to calculate the position of the 5-th node on the next frame? I assume string force on the nodes to be F = -k * x where x is the string length.

All I came up to is that the force between 5 and 1 equals 5 and 2 (the same with 3 and 4). What are the other properties?.

share|improve this question
Is this homework? – Tetrad Jan 21 '11 at 0:59
True, it's written a bit in that way.. I'd love to know what school gives such schoolwork though =) – Jari Komppa Jan 21 '11 at 7:09
No, it's not a homework. I would love too to have such a project as a home task. – Tautrimas Pajarskas Jan 21 '11 at 9:38

2 Answers 2

up vote 1 down vote accepted

I realized one can detect two segment collision by observing 180° change in shortest distance vector comparing with previous frame.


Yep, collision seems to be detected correctly and guess what? The length of the elastic strings is actually zero. It only has this super ability to stretch infinitely. If the length is zero, no sliding is possible. From visual observation, everything seems real, sliding is not needed here.


Something is still wrong. Sliding is needed. It's very visible, when you turn on global gravity and observe one horizontal pair hit vertical pair with velocity. Horizontal one should slide down, but instead, it remains stuck in the middle of the string. Looking in further.


I managed to fix up a formula:

k - general pair's tension.
k1 and k2 - two new tensions for 1 <-> 5 and 2 <-> 5
d - distance 1 <-> 2
d1 and d2 - distance 1 <-> 5 and 2 <-> 5

k2 = k * d / (2 * d2)
k1 = d2 * k2 / d1

Update k1 and k2 for a pair each frame before physics forces integration kicks in and it behaves OK. Basic frictionless sliding has been enabled, finally.

share|improve this answer

for very fast moving line segments or large time intervals, I believe you can still get realistic behavior in a system with constant "energy" without very much calculation, but I have not yet found the solution, I'm curious as to what thoughts you dismissed when you went to the "change in occlusion order" method.

share|improve this answer

Your Answer


