summaryrefslogtreecommitdiff
path: root/src/graphyx/tests/Wave.scala
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2009-11-28 20:25:35 +0000
committerJakob Odersky <jodersky@gmail.com>2009-11-28 20:25:35 +0000
commit5031df4b26afd515274b5ca34f0d5380a99e4223 (patch)
tree41aac12ec2c03426910de72486a2d87e58cebc44 /src/graphyx/tests/Wave.scala
parentfbdf90f0deb14ddd8a457ff1f5f7715e4d3c2f2a (diff)
downloadsims-5031df4b26afd515274b5ca34f0d5380a99e4223.tar.gz
sims-5031df4b26afd515274b5ca34f0d5380a99e4223.tar.bz2
sims-5031df4b26afd515274b5ca34f0d5380a99e4223.zip
Minor graphyx modifications. Added tests. Added 'PrismaticJoint' (still incomplete). Started to transfer 'ForceJoints' to ordinary joints who use only constraints for correction. Started to add materials.
Diffstat (limited to 'src/graphyx/tests/Wave.scala')
-rw-r--r--src/graphyx/tests/Wave.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/graphyx/tests/Wave.scala b/src/graphyx/tests/Wave.scala
new file mode 100644
index 0000000..62ec194
--- /dev/null
+++ b/src/graphyx/tests/Wave.scala
@@ -0,0 +1,27 @@
+package graphyx.tests
+
+import sims.dynamics._
+import sims.dynamics.joints._
+import sims.dynamics.joints.test._
+import sims.geometry._
+
+object Wave extends Test{
+ val title = "Wave"
+ val world = new World {gravity = Vector2D.Null}
+
+ 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
+
+ }
+
+}