core
Vector2
/=
defn
(λ [a, a] Bool)
(/= a b)
=
defn
(λ [(Ref (Vector2 Double)), (Ref (Vector2 Double))] Bool)
(= a b)
add
defn
(λ [(Ref (Vector2 a)), (Ref (Vector2 a))] (Vector2 a))
(add a b)
angle-between
defn
(λ [(Ref (Vector2 Double)), (Ref (Vector2 Double))] Double)
(angle-between a b)
Get the angle between to vectors a and b.
anti-parallel?
defn
(λ [(Ref (Vector2 Double)), (Ref (Vector2 Double))] Bool)
(anti-parallel? a b)
Check whether the two vectors a and b are anti-parallel.
approx
defn
(λ [(Ref (Vector2 Double)), (Ref (Vector2 Double))] Bool)
(approx a b)
Check whether the vectors a and b are approximately equal.
copy
template
(λ [(Ref (Vector2 a))] (Vector2 a))
copies the Vector2
.
delete
template
(λ [(Vector2 a)] ())
deletes a Vector2
. Should usually not be called manually.
dist
defn
(λ [(Ref (Vector2 Double)), (Ref (Vector2 Double))] Double)
(dist a b)
Get the distance between the vectors a and b.
div
defn
(λ [(Ref (Vector2 a)), a] (Vector2 a))
(div a n)
dot
defn
(λ [(Ref (Vector2 a)), (Ref (Vector2 a))] a)
(dot a b)
Get the dot product of the two vectors x and y.
heading
defn
(λ [(Ref (Vector2 Double))] Double)
(heading a)
Get the heading of the vector a.
init
template
(λ [a, a] (Vector2 a))
creates a Vector2
.
lerp
defn
(λ [(Ref (Vector2 a)), (Ref (Vector2 a)), a] (Vector2 a))
(lerp a b amnt)
Linearly interpolate between the two vectors a and b by amnt (between 0 and 1).
mag
defn
(λ [(Ref (Vector2 Double))] Double)
(mag o)
Get the magnitude of a vector.
mag-sq
defn
(λ [(Ref (Vector2 a))] a)
(mag-sq o)
Get the squared magnitude of a vector.
mul
defn
(λ [(Ref (Vector2 a)), a] (Vector2 a))
(mul a n)
normalize
defn
(λ [(Ref (Vector2 Double))] (Vector2 Double))
(normalize o)
Normalize a vector.
parallel?
defn
(λ [(Ref (Vector2 Double)), (Ref (Vector2 Double))] Bool)
(parallel? a b)
Check whether the two vectors a and b are parallel.
perpendicular?
defn
(λ [(Ref (Vector2 Double)), (Ref (Vector2 Double))] Bool)
(perpendicular? a b)
Check whether the two vectors a and b are perpendicular.
prn
template
(λ [(Ref (Vector2 a))] String)
converts a Vector2
to a string.
random
defn
(λ [] (Vector2 Double))
(random)
rotate
defn
(λ [(Ref (Vector2 Double)), Double] (Vector2 Double))
(rotate a n)
Rotate the vector a by the radians n.
set-x
template
(λ [(Vector2 a), a] (Vector2 a))
sets the x
property of a Vector2
.
set-x!
instantiate
(λ [(Ref (Vector2 a)), a] ())
sets the x
property of a Vector2
in place.
set-y
template
(λ [(Vector2 a), a] (Vector2 a))
sets the y
property of a Vector2
.
set-y!
instantiate
(λ [(Ref (Vector2 a)), a] ())
sets the y
property of a Vector2
in place.
str
template
(λ [(Ref (Vector2 a))] String)
converts a Vector2
to a string.
sub
defn
(λ [(Ref (Vector2 a)), (Ref (Vector2 a))] (Vector2 a))
(sub a b)
update-x
instantiate
(λ [(Vector2 a), (Ref (λ [a] a))] (Vector2 a))
updates the x
property of a Vector2
using a function f
.
update-y
instantiate
(λ [(Vector2 a), (Ref (λ [a] a))] (Vector2 a))
updates the y
property of a Vector2
using a function f
.
x
instantiate
(λ [(Ref (Vector2 a))] &a)
gets the x
property of a Vector2
.
y
instantiate
(λ [(Ref (Vector2 a))] &a)
gets the y
property of a Vector2
.
zero
defn
(λ [] (Vector2 Double))
(zero)