summaryrefslogtreecommitdiff
path: root/src/graphyx/tests/Cup.scala
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2009-11-05 21:02:40 +0000
committerJakob Odersky <jodersky@gmail.com>2009-11-05 21:02:40 +0000
commit9d20024aa35cd7f923ebfc1ed9a2ffbf2731da70 (patch)
tree4e97fadc391b310ee1cc7156fda590dff414b2c3 /src/graphyx/tests/Cup.scala
parent034bc5930ea6f01745f64a6070711d899d2c27ae (diff)
downloadsims-9d20024aa35cd7f923ebfc1ed9a2ffbf2731da70.tar.gz
sims-9d20024aa35cd7f923ebfc1ed9a2ffbf2731da70.tar.bz2
sims-9d20024aa35cd7f923ebfc1ed9a2ffbf2731da70.zip
Initial import.
Diffstat (limited to 'src/graphyx/tests/Cup.scala')
-rw-r--r--src/graphyx/tests/Cup.scala31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/graphyx/tests/Cup.scala b/src/graphyx/tests/Cup.scala
new file mode 100644
index 0000000..598a9be
--- /dev/null
+++ b/src/graphyx/tests/Cup.scala
@@ -0,0 +1,31 @@
+/*
+ * Graphyx
+ * copyright (c) 2009 Jakob Odersky
+ * made available under the MIT License
+*/
+
+package graphyx.tests
+
+import sims.dynamics._
+import sims.geometry._
+object Cup extends Test {
+ val title = "Cup"
+ val world = new World
+
+ def init = {
+ val ground = (new Rectangle(1000, 0.1, 1) {friction = 1}).asBody
+ ground.fixed = true
+ world += ground
+
+ val cupShapes = for (i <- 0 to (10 * Math.Pi).toInt) yield new Circle(0.1,1) {pos = Vector2D(Math.cos(-i / 10.0), Math.sin(-i / 10.0)); restitution = 0.0; friction = 1.0}
+ val cup = new Body(cupShapes: _*) {fixed = true; pos = Vector2D(0, 1)}
+ world += cup
+
+ val ball1 = (new Circle(0.2, 1) {pos = Vector2D(0, 2)}).asBody
+ val ball2 = (new Circle(0.2, 1) {pos = Vector2D(-0.4, 2)}).asBody
+ val ball3 = (new Circle(0.2, 1) {pos = Vector2D(0.4, 2)}).asBody
+ world += ball1
+ world += ball2
+ world += ball3
+ }
+}