Anybody know how to simplify this algorithm:
(x1,x2) are the coordinates of the object pulling the other object, and (x2,y2) are the coordinates of the object being pulled.
x2 - x1 = x
x / abs(x) = x_sign
x^2 = u
y2 - y1 = y
y / abs(x) = y_sign
y^2 = v
u / (u + v) = u
1 - u = v
sqrt(u) * x_sign + x1 = x2
sqrt(v) * y_sign + y1 = y2
(x1,x2) are the coordinates of the object pulling the other object, and (x2,y2) are the coordinates of the object being pulled.
x2 - x1 = x
x / abs(x) = x_sign
x^2 = u
y2 - y1 = y
y / abs(x) = y_sign
y^2 = v
u / (u + v) = u
1 - u = v
sqrt(u) * x_sign + x1 = x2
sqrt(v) * y_sign + y1 = y2