Search code examples
javaandroidalgorithmlibgdxgame-physics

Constrain connection/rope/line to avoid stretching


We've been developing a game (2d) in which an object can be connected to static points. Each connection (which is a rope in our case) has a fixed length which can be changed (only one at the time). The situation could look like in the attached picture. Now I would like to find out in which direction the object can be moved and how far until some ropes are fully stretched. In other words, I want to find out which rope can be shortened and how much until some ropes are stretching. Thank you for any hints!

Example situation


Solution

  • Draw a circle with radius equals length of the robe around each static point. The area intersecting all circles is the area the object can move. At the border of the area at least one robe is stretched.