From fbdf90f0deb14ddd8a457ff1f5f7715e4d3c2f2a Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Mon, 16 Nov 2009 11:48:01 +0000 Subject: Added new test. --- doc/all-classes.html | 10 +- doc/graphyx/graphics/Parser$object.html | 12 +- doc/graphyx/gui$content.html | 48 ++++- doc/graphyx/gui$package.html | 9 +- doc/graphyx/gui/AboutHelpFrame$object.html | 98 +++++++++++ doc/graphyx/gui/AboutHelpFrame.html | 138 +++++++++++++++ doc/graphyx/gui/MainPanel.html | 20 +++ doc/graphyx/gui/MenuHelp.html | 202 +++++++++++++++++++++ doc/graphyx/gui/MenuPanel.html | 175 +++++++++++++++++++ doc/graphyx/tests$content.html | 11 ++ doc/graphyx/tests$package.html | 6 +- doc/graphyx/tests/Carriage$object.Car.html | 272 +++++++++++++++++++++++++++++ doc/graphyx/tests/Carriage$object.html | 182 +++++++++++++++++++ doc/graphyx/tests/Test.html | 2 +- doc/sims/dynamics/Body.html | 14 +- doc/sims/dynamics/World.html | 36 ++-- doc/sims/math/Matrix22.html | 18 +- doc/sims/prefabs/Prefab.html | 2 +- doc/sims/util/RelativeVector.html | 16 +- src/graphyx/Graphyx.scala | 1 + src/graphyx/tests/Carriage.scala | 55 ++++++ src/graphyx/tests/EmptyTest.scala | 1 - src/sims/collision/Collision.scala | 1 - 23 files changed, 1270 insertions(+), 59 deletions(-) create mode 100644 doc/graphyx/gui/AboutHelpFrame$object.html create mode 100644 doc/graphyx/gui/AboutHelpFrame.html create mode 100644 doc/graphyx/gui/MenuHelp.html create mode 100644 doc/graphyx/gui/MenuPanel.html create mode 100644 doc/graphyx/tests/Carriage$object.Car.html create mode 100644 doc/graphyx/tests/Carriage$object.html create mode 100644 src/graphyx/tests/Carriage.scala diff --git a/doc/all-classes.html b/doc/all-classes.html index 086233b..a5b98a0 100644 --- a/doc/all-classes.html +++ b/doc/all-classes.html @@ -5,9 +5,11 @@
Classes
Objects
\ No newline at end of file diff --git a/doc/graphyx/gui/AboutHelpFrame$object.html b/doc/graphyx/gui/AboutHelpFrame$object.html new file mode 100644 index 0000000..776fc9f --- /dev/null +++ b/doc/graphyx/gui/AboutHelpFrame$object.html @@ -0,0 +1,98 @@ + + + object AboutHelpFrame in graphyx.gui + + + + + + + + + + + +
+ graphyx.gui +

+ object AboutHelpFrame +

+
+ [source: graphyx/gui/AboutHelpFrame.scala] +

+
+
+ + + object + AboutHelpFrame +
+
extends AnyRef
+
+ + + + + + + + +
Value Summary
+ val + + frame + : AboutHelpFrame + + +
+ + + +
+ Methods inherited from AnyRef +
+ getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized +
+ + +
+ Methods inherited from Any +
+ ==, !=, isInstanceOf, asInstanceOf +
+ + + + + + +
Value Details
+
+ + + val + frame : AboutHelpFrame +
+
+

+ + + +
+ + + + + + + + + \ No newline at end of file diff --git a/doc/graphyx/gui/AboutHelpFrame.html b/doc/graphyx/gui/AboutHelpFrame.html new file mode 100644 index 0000000..5fcd3aa --- /dev/null +++ b/doc/graphyx/gui/AboutHelpFrame.html @@ -0,0 +1,138 @@ + + + class AboutHelpFrame in graphyx.gui + + + + + + + + + + + +
+ graphyx.gui +

+ class AboutHelpFrame +

+
+ [source: graphyx/gui/AboutHelpFrame.scala] +

+
+
+ + + class + AboutHelpFrame +
+
extends scala.swing.Frame
+
+ + + + + +
+ Values and Variables inherited from scala.swing.Frame +
+ scala.swing.Frame.peer +
+ + +
+ Values and Variables inherited from scala.swing.Publisher +
+ scala.swing.Publisher.listeners +
+ + +
+ Values and Variables inherited from scala.swing.Reactor +
+ scala.swing.Reactor.reactions +
+ + + +
+ Methods inherited from scala.swing.Frame +
+ scala.swing.Frame.title, scala.swing.Frame.title_=, scala.swing.Frame.contents_=, scala.swing.Frame.defaultButton, scala.swing.Frame.defaultButton_=, scala.swing.Frame.defaultButton_=, scala.swing.Frame.dispose, scala.swing.Frame.pack, scala.swing.Frame.menuBar, scala.swing.Frame.menuBar_=, scala.swing.Frame.setLocationRelativeTo, scala.swing.Frame.location_=, scala.swing.Frame.iconImage, scala.swing.Frame.iconImage_= +
+ + +
+ Methods inherited from scala.swing.Publisher +
+ scala.swing.Publisher.subscribe, scala.swing.Publisher.unsubscribe, scala.swing.Publisher.publish +
+ + +
+ Methods inherited from scala.swing.Reactor +
+ scala.swing.Reactor.listenTo, scala.swing.Reactor.deafTo +
+ + +
+ Methods inherited from scala.swing.RootPanel +
+ scala.swing.RootPanel.contents +
+ + +
+ Methods inherited from scala.swing.UIElement +
+ scala.swing.UIElement.self, scala.swing.UIElement.foreground, scala.swing.UIElement.foreground_=, scala.swing.UIElement.background, scala.swing.UIElement.background_=, scala.swing.UIElement.minimumSize, scala.swing.UIElement.minimumSize_=, scala.swing.UIElement.maximumSize, scala.swing.UIElement.maximumSize_=, scala.swing.UIElement.preferredSize, scala.swing.UIElement.preferredSize_=, scala.swing.UIElement.preferredSize_=, scala.swing.UIElement.font, scala.swing.UIElement.font_=, scala.swing.UIElement.locationOnScreen, scala.swing.UIElement.location, scala.swing.UIElement.bounds, scala.swing.UIElement.size, scala.swing.UIElement.size_=, scala.swing.UIElement.size_=, scala.swing.UIElement.locale, scala.swing.UIElement.toolkit, scala.swing.UIElement.cursor, scala.swing.UIElement.cursor_=, scala.swing.UIElement.visible, scala.swing.UIElement.visible_=, scala.swing.UIElement.showing, scala.swing.UIElement.repaint +
+ + +
+ Methods inherited from scala.Proxy +
+ scala.Proxy.hashCode, scala.Proxy.equals, scala.Proxy.toString +
+ + +
+ Methods inherited from AnyRef +
+ getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized +
+ + +
+ Methods inherited from Any +
+ ==, !=, isInstanceOf, asInstanceOf +
+ + + + + + + + +
+ + + + + + + + + \ No newline at end of file diff --git a/doc/graphyx/gui/MainPanel.html b/doc/graphyx/gui/MainPanel.html index a02c4c1..57eb648 100644 --- a/doc/graphyx/gui/MainPanel.html +++ b/doc/graphyx/gui/MainPanel.html @@ -79,6 +79,17 @@ : InfoPanel + + + + + val + + + menuPanel + : MenuPanel + + @@ -247,6 +258,15 @@

+
+
+ + + val + menuPanel : MenuPanel +
+
+

diff --git a/doc/graphyx/gui/MenuHelp.html b/doc/graphyx/gui/MenuHelp.html new file mode 100644 index 0000000..311784d --- /dev/null +++ b/doc/graphyx/gui/MenuHelp.html @@ -0,0 +1,202 @@ + + + class MenuHelp in graphyx.gui + + + + + + + + + + + +
+ graphyx.gui +

+ class MenuHelp +

+
+
+
+ + + class + MenuHelp +
+
extends scala.swing.Menu
+
+ + + + + + + + + + + + +
Value Summary
+ val + + components + : scala.List[scala.swing.MenuItem] + + +
+ val + + miAbout + : scala.swing.MenuItem + + +
+ + +
+ Values and Variables inherited from scala.swing.Menu +
+ scala.swing.Menu.peer +
+ + +
+ Values and Variables inherited from scala.swing.SequentialContainer.Wrapper +
+ scala.swing.SequentialContainer.Wrapper.contents +
+ + +
+ Values and Variables inherited from scala.swing.Container.Wrapper +
+ scala.swing.Container.Wrapper._contents +
+ + +
+ Values and Variables inherited from scala.swing.Component +
+ scala.swing.Component.initP +
+ + +
+ Values and Variables inherited from scala.swing.Publisher +
+ scala.swing.Publisher.listeners +
+ + +
+ Values and Variables inherited from scala.swing.Reactor +
+ scala.swing.Reactor.reactions +
+ + + +
+ Methods inherited from scala.swing.AbstractButton +
+ scala.swing.AbstractButton.text, scala.swing.AbstractButton.text_=, scala.swing.AbstractButton.icon, scala.swing.AbstractButton.icon_=, scala.swing.AbstractButton.pressedIcon, scala.swing.AbstractButton.pressedIcon_=, scala.swing.AbstractButton.selectedIcon, scala.swing.AbstractButton.selectedIcon_=, scala.swing.AbstractButton.disabledIcon, scala.swing.AbstractButton.disabledIcon_=, scala.swing.AbstractButton.disabledSelectedIcon, scala.swing.AbstractButton.disabledSelectedIcon_=, scala.swing.AbstractButton.rolloverIcon, scala.swing.AbstractButton.rolloverIcon_=, scala.swing.AbstractButton.rolloverSelectedIcon, scala.swing.AbstractButton.rolloverSelectedIcon_=, scala.swing.AbstractButton.action, scala.swing.AbstractButton.action_=, scala.swing.AbstractButton.selected, scala.swing.AbstractButton.selected_=, scala.swing.AbstractButton.contentAreaFilled, scala.swing.AbstractButton.contentAreaFilled_=, scala.swing.AbstractButton.borderPainted, scala.swing.AbstractButton.borderPainted_=, scala.swing.AbstractButton.focusPainted, scala.swing.AbstractButton.focusPainted_=, scala.swing.AbstractButton.rolloverEnabled, scala.swing.AbstractButton.rolloverEnabled_=, scala.swing.AbstractButton.verticalTextPosition, scala.swing.AbstractButton.verticalTextPosition_=, scala.swing.AbstractButton.verticalAlignment, scala.swing.AbstractButton.verticalAlignment_=, scala.swing.AbstractButton.horizontalTextPosition, scala.swing.AbstractButton.horizontalTextPosition_=, scala.swing.AbstractButton.horizontalAlignment, scala.swing.AbstractButton.horizontalAlignment_=, scala.swing.AbstractButton.iconTextGap, scala.swing.AbstractButton.iconTextGap_=, scala.swing.AbstractButton.mnemonic, scala.swing.AbstractButton.mnemonic_=, scala.swing.AbstractButton.displayedMnemonicIndex, scala.swing.AbstractButton.displayedMnemonicIndex_=, scala.swing.AbstractButton.multiClickThreshold, scala.swing.AbstractButton.multiClickThreshold_=, scala.swing.AbstractButton.doClick, scala.swing.AbstractButton.doClick, scala.swing.AbstractButton.margin, scala.swing.AbstractButton.margin_= +
+ + +
+ Methods inherited from scala.swing.Component +
+ scala.swing.Component.xLayoutAlignment, scala.swing.Component.xLayoutAlignment_=, scala.swing.Component.yLayoutAlignment, scala.swing.Component.yLayoutAlignment_=, scala.swing.Component.border, scala.swing.Component.border_=, scala.swing.Component.opaque, scala.swing.Component.opaque_=, scala.swing.Component.enabled, scala.swing.Component.enabled_=, scala.swing.Component.tooltip, scala.swing.Component.tooltip_=, scala.swing.Component.inputVerifier, scala.swing.Component.inputVerifier_=, scala.swing.Component.revalidate, scala.swing.Component.requestFocus, scala.swing.Component.paintComponent, scala.swing.Component.paint, scala.swing.Component.toString +
+ + +
+ Methods inherited from scala.swing.Publisher +
+ scala.swing.Publisher.subscribe, scala.swing.Publisher.unsubscribe, scala.swing.Publisher.publish +
+ + +
+ Methods inherited from scala.swing.Reactor +
+ scala.swing.Reactor.listenTo, scala.swing.Reactor.deafTo +
+ + +
+ Methods inherited from scala.swing.UIElement +
+ scala.swing.UIElement.self, scala.swing.UIElement.foreground, scala.swing.UIElement.foreground_=, scala.swing.UIElement.background, scala.swing.UIElement.background_=, scala.swing.UIElement.minimumSize, scala.swing.UIElement.minimumSize_=, scala.swing.UIElement.maximumSize, scala.swing.UIElement.maximumSize_=, scala.swing.UIElement.preferredSize, scala.swing.UIElement.preferredSize_=, scala.swing.UIElement.preferredSize_=, scala.swing.UIElement.font, scala.swing.UIElement.font_=, scala.swing.UIElement.locationOnScreen, scala.swing.UIElement.location, scala.swing.UIElement.bounds, scala.swing.UIElement.size, scala.swing.UIElement.size_=, scala.swing.UIElement.size_=, scala.swing.UIElement.locale, scala.swing.UIElement.toolkit, scala.swing.UIElement.cursor, scala.swing.UIElement.cursor_=, scala.swing.UIElement.visible, scala.swing.UIElement.visible_=, scala.swing.UIElement.showing, scala.swing.UIElement.repaint +
+ + +
+ Methods inherited from scala.Proxy +
+ scala.Proxy.hashCode, scala.Proxy.equals +
+ + +
+ Methods inherited from AnyRef +
+ getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized +
+ + +
+ Methods inherited from Any +
+ ==, !=, isInstanceOf, asInstanceOf +
+ + + + + + +
Value Details
+
+ + + val + miAbout : scala.swing.MenuItem +
+
+

+
+
+ + + val + components : scala.List[scala.swing.MenuItem] +
+
+

+ + + +
+ + + + + + + + + \ No newline at end of file diff --git a/doc/graphyx/gui/MenuPanel.html b/doc/graphyx/gui/MenuPanel.html new file mode 100644 index 0000000..a685510 --- /dev/null +++ b/doc/graphyx/gui/MenuPanel.html @@ -0,0 +1,175 @@ + + + class MenuPanel in graphyx.gui + + + + + + + + + + + +
+ graphyx.gui +

+ class MenuPanel +

+
+
+
+ + + class + MenuPanel(container : Container) +
+
extends scala.swing.BoxPanel
+
+ + + + + + + + +
Value Summary
+ val + + mnu + : scala.swing.MenuBar + + +
+ + +
+ Values and Variables inherited from scala.swing.BoxPanel +
+ scala.swing.BoxPanel.peer +
+ + +
+ Values and Variables inherited from scala.swing.SequentialContainer.Wrapper +
+ scala.swing.SequentialContainer.Wrapper.contents +
+ + +
+ Values and Variables inherited from scala.swing.Container.Wrapper +
+ scala.swing.Container.Wrapper._contents +
+ + +
+ Values and Variables inherited from scala.swing.Component +
+ scala.swing.Component.initP +
+ + +
+ Values and Variables inherited from scala.swing.Publisher +
+ scala.swing.Publisher.listeners +
+ + +
+ Values and Variables inherited from scala.swing.Reactor +
+ scala.swing.Reactor.reactions +
+ + + +
+ Methods inherited from scala.swing.Component +
+ scala.swing.Component.xLayoutAlignment, scala.swing.Component.xLayoutAlignment_=, scala.swing.Component.yLayoutAlignment, scala.swing.Component.yLayoutAlignment_=, scala.swing.Component.border, scala.swing.Component.border_=, scala.swing.Component.opaque, scala.swing.Component.opaque_=, scala.swing.Component.enabled, scala.swing.Component.enabled_=, scala.swing.Component.tooltip, scala.swing.Component.tooltip_=, scala.swing.Component.inputVerifier, scala.swing.Component.inputVerifier_=, scala.swing.Component.revalidate, scala.swing.Component.requestFocus, scala.swing.Component.paintComponent, scala.swing.Component.paint, scala.swing.Component.toString +
+ + +
+ Methods inherited from scala.swing.Publisher +
+ scala.swing.Publisher.subscribe, scala.swing.Publisher.unsubscribe, scala.swing.Publisher.publish +
+ + +
+ Methods inherited from scala.swing.Reactor +
+ scala.swing.Reactor.listenTo, scala.swing.Reactor.deafTo +
+ + +
+ Methods inherited from scala.swing.UIElement +
+ scala.swing.UIElement.self, scala.swing.UIElement.foreground, scala.swing.UIElement.foreground_=, scala.swing.UIElement.background, scala.swing.UIElement.background_=, scala.swing.UIElement.minimumSize, scala.swing.UIElement.minimumSize_=, scala.swing.UIElement.maximumSize, scala.swing.UIElement.maximumSize_=, scala.swing.UIElement.preferredSize, scala.swing.UIElement.preferredSize_=, scala.swing.UIElement.preferredSize_=, scala.swing.UIElement.font, scala.swing.UIElement.font_=, scala.swing.UIElement.locationOnScreen, scala.swing.UIElement.location, scala.swing.UIElement.bounds, scala.swing.UIElement.size, scala.swing.UIElement.size_=, scala.swing.UIElement.size_=, scala.swing.UIElement.locale, scala.swing.UIElement.toolkit, scala.swing.UIElement.cursor, scala.swing.UIElement.cursor_=, scala.swing.UIElement.visible, scala.swing.UIElement.visible_=, scala.swing.UIElement.showing, scala.swing.UIElement.repaint +
+ + +
+ Methods inherited from scala.Proxy +
+ scala.Proxy.hashCode, scala.Proxy.equals +
+ + +
+ Methods inherited from AnyRef +
+ getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized +
+ + +
+ Methods inherited from Any +
+ ==, !=, isInstanceOf, asInstanceOf +
+ + + + + + +
Value Details
+
+ + + val + mnu : scala.swing.MenuBar +
+
+

+ + + +
+ + + + + + + + + \ No newline at end of file diff --git a/doc/graphyx/tests$content.html b/doc/graphyx/tests$content.html index c136e55..a16a70b 100644 --- a/doc/graphyx/tests$content.html +++ b/doc/graphyx/tests$content.html @@ -28,6 +28,17 @@ extends Test + + + + + object + + + Carriage + extends Test + + diff --git a/doc/graphyx/tests$package.html b/doc/graphyx/tests$package.html index b3a9adc..7afa1bc 100644 --- a/doc/graphyx/tests$package.html +++ b/doc/graphyx/tests$package.html @@ -8,11 +8,13 @@ graphyx.tests
Classes
Objects
Direct Known Subclasses:
-
BallStack, Chain, CompositeShape, Cup, EmptyTest, Friction, Friction2, General1, General2, Joints1, Joints2, Net, RagdollTest, Restitution, Stacking
+
BallStack, Carriage, Chain, CompositeShape, Cup, EmptyTest, Friction, Friction2, General1, General2, Joints1, Joints2, Net, RagdollTest, Restitution, Stacking

diff --git a/doc/sims/dynamics/Body.html b/doc/sims/dynamics/Body.html index 20abf83..7ac6091 100644 --- a/doc/sims/dynamics/Body.html +++ b/doc/sims/dynamics/Body.html @@ -159,11 +159,10 @@ def - applyForce - (force : Vector2D, point : Vector2D) : Unit + applyForce + (force : Vector2D) : Unit -
Wendet eine Kraft auf einen Punkt dieses Koerpers an. Achtung: der gegebene Punkt wird nicht auf angehoerigkeit dieses - Koerpers ueberprueft.
+
Wendet eine Kraft auf den Schwerpunkt dieses Koerpers an.
@@ -171,10 +170,11 @@ def - applyForce - (force : Vector2D) : Unit + applyForce + (force : Vector2D, point : Vector2D) : Unit -
Wendet eine Kraft auf den Schwerpunkt dieses Koerpers an.
+
Wendet eine Kraft auf einen Punkt dieses Koerpers an. Achtung: der gegebene Punkt wird nicht auf angehoerigkeit dieses + Koerpers ueberprueft.
diff --git a/doc/sims/dynamics/World.html b/doc/sims/dynamics/World.html index df1948a..6c882fe 100644 --- a/doc/sims/dynamics/World.html +++ b/doc/sims/dynamics/World.html @@ -202,10 +202,10 @@ def - += - (joint : Joint) : Unit + += + (body : Body) : Unit -
Fuegt dieser Welt eine Verbindung hinzu.
+
Fuegt dieser Welt einen Koerper hinzu.
@@ -213,10 +213,10 @@ def - += - (body : Body) : Unit + += + (p : Prefab) : Unit -
Fuegt dieser Welt einen Koerper hinzu.
+
Fuegt dieser Welt ein vorangefertigtes System vaus Koerpern und Verbindungen hinzu.
@@ -224,10 +224,10 @@ def - += - (p : Prefab) : Unit + += + (joint : Joint) : Unit -
Fuegt dieser Welt ein vorangefertigtes System vaus Koerpern und Verbindungen hinzu.
+
Fuegt dieser Welt eine Verbindung hinzu.
@@ -246,10 +246,10 @@ def - -= - (joint : Joint) : Unit + -= + (body : Body) : Unit -
Entfernt die gegebene Verbindung aus dieser Welt.
+
Entfernt den gegebenen Koerper aus dieser Welt.
@@ -257,10 +257,10 @@ def - -= - (p : Prefab) : Unit + -= + (joint : Joint) : Unit -
Entfernt das gegebene System aus Koerpern und Verbindungen aus dieser Welt.
+
Entfernt die gegebene Verbindung aus dieser Welt.
@@ -268,10 +268,10 @@ def - -= - (body : Body) : Unit + -= + (p : Prefab) : Unit -
Entfernt den gegebenen Koerper aus dieser Welt.
+
Entfernt das gegebene System aus Koerpern und Verbindungen aus dieser Welt.
diff --git a/doc/sims/math/Matrix22.html b/doc/sims/math/Matrix22.html index 82cf176..fe05b63 100644 --- a/doc/sims/math/Matrix22.html +++ b/doc/sims/math/Matrix22.html @@ -61,10 +61,10 @@ def - * - (v : Vector2D) : Vector2D + * + (n : Double) : Matrix22 -
Multiplikation mit einer 2x1-Matrix (2-dimensionaler Vektor).
+
Multiplikation mit einem Skalar.
@@ -72,10 +72,10 @@ def - * - (n : Double) : Matrix22 + * + (m : Matrix22) : Matrix22 -
Multiplikation mit einem Skalar.
+
Multiplikation mit einer anderen 2x2-Matrix.
@@ -83,10 +83,10 @@ def - * - (m : Matrix22) : Matrix22 + * + (v : Vector2D) : Vector2D -
Multiplikation mit einer anderen 2x2-Matrix.
+
Multiplikation mit einer 2x1-Matrix (2-dimensionaler Vektor).
diff --git a/doc/sims/prefabs/Prefab.html b/doc/sims/prefabs/Prefab.html index 83deb42..699ecf9 100644 --- a/doc/sims/prefabs/Prefab.html +++ b/doc/sims/prefabs/Prefab.html @@ -34,7 +34,7 @@
extends AnyRef
Direct Known Subclasses:
-
Net, Pylon, Ragdoll
+
Carriage.Car, Net, Pylon, Ragdoll

diff --git a/doc/sims/util/RelativeVector.html b/doc/sims/util/RelativeVector.html index defc526..ed726df 100644 --- a/doc/sims/util/RelativeVector.html +++ b/doc/sims/util/RelativeVector.html @@ -109,8 +109,8 @@ def - left - (point : Vector2D) : Vector2D + left + (s : Shape) : Vector2D @@ -120,8 +120,8 @@ def - left - (s : Shape) : Vector2D + left + (point : Vector2D) : Vector2D @@ -131,8 +131,8 @@ def - right - (point : Vector2D) : Vector2D + right + (s : Shape) : Vector2D @@ -142,8 +142,8 @@ def - right - (s : Shape) : Vector2D + right + (point : Vector2D) : Vector2D diff --git a/src/graphyx/Graphyx.scala b/src/graphyx/Graphyx.scala index cfd67c6..81a8ee8 100644 --- a/src/graphyx/Graphyx.scala +++ b/src/graphyx/Graphyx.scala @@ -27,6 +27,7 @@ object Graphyx{ Friction2, Restitution, RagdollTest, + Carriage, General1, General2, EmptyTest diff --git a/src/graphyx/tests/Carriage.scala b/src/graphyx/tests/Carriage.scala new file mode 100644 index 0000000..967c6e5 --- /dev/null +++ b/src/graphyx/tests/Carriage.scala @@ -0,0 +1,55 @@ +/* + * Graphyx + * copyright (c) 2009 Jakob Odersky + * made available under the MIT License +*/ + +package graphyx.tests + +import sims.dynamics._ +import sims.dynamics.joints._ +import sims.geometry._ + +object Carriage extends Test{ + val title = "Carriage" + val world = new World + + def init = { + val car = new Car + + val groundShapes = for (i <- (0 to 200).toList) yield (new Rectangle(0.2, 0.1, 1) { + pos = Vector2D(0.4 * i, 0) + transientShapes += car.chassis.shapes(0) + }) + val ground = new Body(groundShapes: _*) //Rectangle(100, 0.1, 1).asBody + ground.pos = Vector2D(0,0) + ground.fixed = true + ground.rotation = -0.2 + + + world += ground + world += car + + } + + class Car extends sims.prefabs.Prefab { + + val chassis = (new Rectangle(0.5, 0.05, 10) {pos = Vector2D(0, 1)}).asBody + val rightWheel = (new Circle(0.1, 10) {pos = Vector2D(0.4,0.8)}).asBody + val leftWheel = (new Circle(0.1, 10) {pos = Vector2D(-0.4,0.8)}).asBody + + override val bodies = List(chassis, rightWheel, leftWheel) + + val rightStabelizer = new DistanceJoint(chassis, rightWheel) + val rightDamper = new SpringJoint(chassis, chassis.pos + Vector2D(rightWheel.pos.x, 0), + rightWheel, rightWheel.pos, 500) {damping = 1} + + val leftStabelizer = new DistanceJoint(chassis, leftWheel) + val leftDamper = new SpringJoint(chassis, chassis.pos + Vector2D(leftWheel.pos.x, 0), + leftWheel, leftWheel.pos, 500) {damping = 1} + + override val joints = List(rightStabelizer, rightDamper, leftStabelizer, leftDamper) + + } + +} diff --git a/src/graphyx/tests/EmptyTest.scala b/src/graphyx/tests/EmptyTest.scala index bbca800..585a053 100644 --- a/src/graphyx/tests/EmptyTest.scala +++ b/src/graphyx/tests/EmptyTest.scala @@ -11,5 +11,4 @@ object EmptyTest extends Test{ override val title = "Empty Test" val world = new World def init = {} - } diff --git a/src/sims/collision/Collision.scala b/src/sims/collision/Collision.scala index ad23f4d..d674b30 100644 --- a/src/sims/collision/Collision.scala +++ b/src/sims/collision/Collision.scala @@ -69,7 +69,6 @@ abstract class Collision extends Constraint { val cr2 = r2 cross tangent val invMass = 1/b1.mass * (tangent dot tangent) + 1/b1.I * cr1 * cr1 + 1/b2.mass * (tangent dot tangent) + 1/b2.I * cr2 * cr2 val m = if (invMass == 0.0) 0.0 else 1/invMass - val mu = shape1.friction * shape2.friction val lambda = -m * Cdot val cf = shape1.friction * shape2.friction val cl = Math.min(Math.max(-normalForce * cf * h, lambda), normalForce * cf * h) -- cgit v1.2.3