aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/sims/dsl/RichBody.scala
diff options
context:
space:
mode:
authorJakob Odersky <jodersky@gmail.com>2011-08-26 20:29:25 +0200
committerJakob Odersky <jodersky@gmail.com>2011-08-26 20:29:25 +0200
commit2750bc0277c3d929603daceee2e8a1e88368a306 (patch)
tree2db8bdecf84971e550bacb7737a1c19ababb87df /src/main/scala/sims/dsl/RichBody.scala
downloadsims2-2750bc0277c3d929603daceee2e8a1e88368a306.tar.gz
sims2-2750bc0277c3d929603daceee2e8a1e88368a306.tar.bz2
sims2-2750bc0277c3d929603daceee2e8a1e88368a306.zip
import from local directory
Diffstat (limited to 'src/main/scala/sims/dsl/RichBody.scala')
-rw-r--r--src/main/scala/sims/dsl/RichBody.scala33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main/scala/sims/dsl/RichBody.scala b/src/main/scala/sims/dsl/RichBody.scala
new file mode 100644
index 0000000..0c7b234
--- /dev/null
+++ b/src/main/scala/sims/dsl/RichBody.scala
@@ -0,0 +1,33 @@
+/* _____ _ __ ________ ___ *\
+** / ___/(_) |/ / ___/ |__ \ Simple Mechanics Simulator 2 **
+** \__ \/ / /|_/ /\__ \ __/ / copyright (c) 2011 Jakob Odersky **
+** ___/ / / / / /___/ / / __/ **
+** /____/_/_/ /_//____/ /____/ **
+\* */
+
+package sims.dsl
+
+import sims.dynamics._
+import sims.math._
+
+class RichBody(val body: Body) {
+
+ def at(point: Vector2D) = new BodyPoint(body, point)
+ def atLocal(point: Vector2D) = new BodyPoint(body, body.position + point)
+
+ def :@(point: Vector2D) = at(point)
+ def :@@(point: Vector2D) = atLocal(point)
+ def @:(point: Vector2D) = at(point)
+ def @@:(point: Vector2D) = atLocal(point)
+
+ def @@(point: Vector2D) = at(point)
+}
+
+
+object Test {
+ val b = new Body(null)
+
+
+ val q = b :@@ (1.0, 2.0) revolute b
+
+} \ No newline at end of file