summaryrefslogtreecommitdiffstats
path: root/src/fdgl.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-12-18 19:38:58 +0000
committerDavid Robillard <d@drobilla.net>2013-12-18 19:38:58 +0000
commit63c2c34dd2b4ae5be99284b94c0b99d39600bd6f (patch)
tree364b54ae6981b9cbc539013471ff7a7382577fce /src/fdgl.hpp
parent5b34aff56759854ee18dbd901264ee445a232703 (diff)
downloadganv-63c2c34dd2b4ae5be99284b94c0b99d39600bd6f.tar.gz
ganv-63c2c34dd2b4ae5be99284b94c0b99d39600bd6f.tar.bz2
ganv-63c2c34dd2b4ae5be99284b94c0b99d39600bd6f.zip
FDGL: Add spring between partners so interface modules line up in Patchage.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@5181 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/fdgl.hpp')
-rw-r--r--src/fdgl.hpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/fdgl.hpp b/src/fdgl.hpp
index cabdba8..844912e 100644
--- a/src/fdgl.hpp
+++ b/src/fdgl.hpp
@@ -17,7 +17,6 @@
#include <math.h>
static const double SPRING_K = 12.0;
-static const double SPRING_LEN = 0.1;
static const double CHARGE_KE = 80000.0;
static const double AREA_WEIGHT = 0.4;
@@ -57,11 +56,11 @@ vec_rmag(const Vector& vec)
/** Hooke's law */
inline Vector
-spring_force(const Vector& a, const Vector& b)
+spring_force(const Vector& a, const Vector& b, const double length)
{
const Vector vec = vec_sub(b, a);
const double rmag = vec_rmag(vec);
- const double displacement = SPRING_LEN - (1.0 / rmag);
+ const double displacement = length - (1.0 / rmag);
return vec_mult(vec, rmag * SPRING_K * displacement * 0.5);
}