Carp/examples/vector.carp

16 lines
565 B
Plaintext
Raw Permalink Normal View History

(load "core/Vector.carp") ;; specified path to avoid loading itself on case insensitive file systems
(load "core/Geometry.carp")
2017-12-12 17:08:33 +03:00
(use-all IO Vector2 Geometry)
(defn main []
(let [x (Vector2.init 1.0 2.0)
y (Vector2.init 3.0 4.0)]
(do
2017-12-13 13:12:34 +03:00
(println &(str &(Vector2.add &x &y)))
(println &(str &x))
(println &(str &y))
(println &(Double.str (Vector2.mag &y)))
2017-12-13 13:12:34 +03:00
(println &(str &(Vector2.rotate &x (Geometry.degree-to-radians 90.0))))
2017-10-20 01:44:25 +03:00
(println &(Double.str (Geometry.radians-to-degree (Vector2.angle-between &x &y)))))))