aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/sims/dsl/RichBody.scala
diff options
context:
space:
mode:
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