The class ITensileNetwork creates a network which consists of particles and tension lines. It has friction and strength of tension as physical properties, no gravity unfortunately!!
The code below produces five tension lines fixed at one end tied together from a common node, the result will be an equilibrium of forces, in other words the minimum total distance from a point to all fixed nodes.
code:
import processing.opengl.*;
import igeo.*;
size( 800, 600, IG.GL );
int ptsNo = 5;
ITensionLine[] links = new ITensionLine[ptsNo];
IVecI[] nodes = new IVec[1];
ITensileNet itn = new ITensileNet();
links[0] = new ITensionLine(IRandom.pt(0, 10), IRandom.pt(0, 10));
nodes[0] = new IVec(links[0].end());
for (int i=1; i<ptsNo; i++)
{
links[i] = new ITensionLine(links[i-1].pt(2), IRandom.pt(0, 10));
}
itn.create(links, nodes);

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales License.
