Carp/examples/vector.carp
2017-12-13 11:12:34 +01:00

16 lines
478 B
Plaintext

(load "Vector.carp")
(load "Geometry.carp")
(use-all IO Vector2 Geometry)
(defn main []
(let [x (Vector2.init 1.0 2.0)
y (Vector2.init 3.0 4.0)]
(do
(println &(str &(Vector2.add &x &y)))
(println &(str &x))
(println &(str &y))
(println &(Double.str (Vector2.mag &y)))
(println &(str &(Vector2.rotate &x (Geometry.degree-to-radians 90.0))))
(println &(Double.str (Geometry.radians-to-degree (Vector2.angle-between &x &y)))))))