diff options
Diffstat (limited to 'src/graphyx/tests/Spring.scala')
-rw-r--r-- | src/graphyx/tests/Spring.scala | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/graphyx/tests/Spring.scala b/src/graphyx/tests/Spring.scala index 439259f..e7fecb8 100644 --- a/src/graphyx/tests/Spring.scala +++ b/src/graphyx/tests/Spring.scala @@ -7,23 +7,14 @@ import java.io._ object Spring extends Test{ val title = "Spring" - //val fout = new java.io.FileOutputStream("out.csv") - //val sout = new java.io.PrintStream(fout) - val world = new World { - override def postStep = { - //for (b <- bodies; if (b.monitor)) sout.println(monitors(0)._2(b)) - } - } + val world = new World def init = { val anchor = Circle(0.05, 10).asBody anchor.fixed = true - val particle = (new Circle(0.1, 10) {pos = Vector2D(0, -1)}).asBody - val spring = new SpringJoint(anchor, particle, 500, 0.6) - //val spring = new PrismaticJoint(anchor, particle) - spring.damping = 1 - particle.monitor = true - world.monitors += ("", _.pos.y.toString) + val particle = (new Circle(0.1, 20) {pos = Vector2D(0, -3)}).asBody + val spring = new SpringJoint(anchor, particle, 500, 2) + spring.damping = 0.5 world += anchor world += particle |