Here is the basic code which controles the particles:
verlet(i).nx = 2*verlet(i).x - verlet(i).xo + verlet(i).ax
verlet(i).ny = 2*verlet(i).y - verlet(i).yo + verlet(i).ay
verlet(i).xo = verlet(i).x
verlet(i).yo = verlet(i).y
verlet(i).x = verlet(i).nx
verlet(i).y = verlet(i).ny
let me explain the variables....
x and y -- the particles x and y positions!
nx and ny -- the particles new x and y positions
xo and yo -- the particles old x and y positions
This is all you need to get the particles moving!
notice how theres no x=x+xvel. Velocity in this case would be:
vel_x# = verlet(i).nx - verlet(i).xo
vel_y# = verlet(i).ny - verlet(i).yo
Here is the main code in the constraint function:
angle = get_angle(verlet(con(i).ver1).x - verlet(con(i).ver2).x , verlet(con(i).ver1).y - verlet(con(i).ver2).y )
distance =sqrt ( ( (verlet(con(i).ver1).x-verlet(con(i).ver2).x)^2 + (verlet(con(i).ver1).y-verlet(con(i).ver2).y)^2 ) )
moveamount = distance - con(i).rest
mx = -cos(angle)
my = sin(angle)
verlet(con(i).ver1).x = verlet(con(i).ver1).x + mx*moveamount*0.5
verlet(con(i).ver1).y = verlet(con(i).ver1).y + my*moveamount*0.5
verlet(con(i).ver2).x = verlet(con(i).ver2).x - mx*moveamount*0.5
verlet(con(i).ver2).y = verlet(con(i).ver2).y - my*moveamount*0.5
you need this function also (well you don't really)
function get_angle( x as double float , y as double float )
angle as double float
angle = atanfull(x,y)-90
endfunction angle
I know some stuff won't make compleate sense because alot of the code is missing but that should be enough to get particles into your program and joint em together.
Have fun.