diff options
Diffstat (limited to 'src/graphyx/tests/Wave.scala')
-rw-r--r-- | src/graphyx/tests/Wave.scala | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/graphyx/tests/Wave.scala b/src/graphyx/tests/Wave.scala index 62ec194..d3359c1 100644 --- a/src/graphyx/tests/Wave.scala +++ b/src/graphyx/tests/Wave.scala @@ -11,17 +11,24 @@ object Wave extends Test{ def init = { val n = 50 - val anchors = for (i <- (0 to n).toList) yield (new Body(new Circle(0.01,1) {pos = Vector2D(0.4 * i, 5)}) {fixed = true}) - val particles = for (i <- (0 to n).toList) yield (new Body(new Circle(0.1,10) {pos = Vector2D(0.4 * i, 0)})) - val rails = (for (i <- (0 to n).toList) yield (new PrismaticJoint(anchors(i), particles(i)))) - val springs = (for (i <- (0 to n).toList) yield (new SpringJoint(anchors(i), particles(i), 5)))// {damping = 0.00})) - world ++= anchors - world ++= particles - for (j <- rails ++ springs) world += j - val lateralSprings = (for (i <- (0 to (n - 1)).toList) yield (new SpringJoint(particles(i), particles(i + 1), 50.0))) - for (j <- lateralSprings) world += j + val anchors = for (i <- (0 to n).toList) yield + new Body(new Circle(0.01,1) {pos = Vector2D(0.4 * i, 5)}) {fixed = true} + + val particles = for (i <- (0 to n).toList) yield + new Body(new Circle(0.1,10) {pos = Vector2D(0.4 * i, 0)}) + + val rails = for (i <- (0 to n).toList) yield + new PrismaticJoint(anchors(i), particles(i)) + + val springs = for (i <- (0 to n).toList) yield + new SpringJoint(anchors(i), particles(i), 5)// {damping = 0.00}) + val lateralSprings = for (i <- (0 to (n - 1)).toList) yield + new SpringJoint(particles(i), particles(i + 1), 50.0) + + world ++= anchors + world ++= particles + for (j <- rails ++ springs ++ lateralSprings) world += j } - } |