From 9d20024aa35cd7f923ebfc1ed9a2ffbf2731da70 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Thu, 5 Nov 2009 21:02:40 +0000 Subject: Initial import. --- src/sims/util/Positioning.scala | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/sims/util/Positioning.scala (limited to 'src/sims/util/Positioning.scala') diff --git a/src/sims/util/Positioning.scala b/src/sims/util/Positioning.scala new file mode 100644 index 0000000..433feaf --- /dev/null +++ b/src/sims/util/Positioning.scala @@ -0,0 +1,24 @@ +/* + * Simple Mechanics Simulator (SiMS) + * copyright (c) 2009 Jakob Odersky + * made available under the MIT License +*/ + +package sims.util + +import sims.geometry._ +import sims.dynamics._ + +/**Objekt mit Hiflsfunktionen fuer komfortables Positionieren von Koerpern.*/ +object Positioning { + + implicit def int2RelativeVector(x: Int): RelativeVector = new RelativeVector(x, 0) + implicit def double2RelativeVector(x: Double): RelativeVector = new RelativeVector(x, 0) + implicit def vector2RelativeVector(v: Vector2D): RelativeVector = new RelativeVector(v.x, v.y) + implicit def polar2Carthesian(p: Polar): Vector2D = p.toCarthesian + implicit def polar2RelativeVector(p: Polar): RelativeVector = vector2RelativeVector(p.toCarthesian) + + def position(s: Shape)(a: Vector2D) = { + s.pos = a + } +} -- cgit v1.2.3