summaryrefslogtreecommitdiff
path: root/src/main/scala/sims/util/Polar.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/sims/util/Polar.scala')
-rw-r--r--src/main/scala/sims/util/Polar.scala17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/scala/sims/util/Polar.scala b/src/main/scala/sims/util/Polar.scala
new file mode 100644
index 0000000..494c984
--- /dev/null
+++ b/src/main/scala/sims/util/Polar.scala
@@ -0,0 +1,17 @@
+/*
+ * Simple Mechanics Simulator (SiMS)
+ * copyright (c) 2009 Jakob Odersky
+ * made available under the MIT License
+*/
+
+package sims.util
+
+import sims.geometry._
+import scala.math._
+
+/**Polar coordinates.*/
+case class Polar(distance: Double, angle: Double) {
+
+ /**Returns the vector representation of these polar coordinates.*/
+ def toCarthesian = Vector2D(distance * sin(angle), distance * cos(angle))
+}