Vector3
is a three-dimensional vector data type.
=
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) b)] Bool)
(= o1 o2)
add
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c)] (Vector3 a))
(add a b)
angle-between
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c)] a)
(angle-between a b)
Get the angle between two vectors a and b.
anti-parallel?
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c)] Bool)
(anti-parallel? a b)
Check whether the two vectors a and b are anti-parallel.
cmul
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c)] (Vector3 a))
(cmul a b)
copy
template
(Fn [(Ref (Vector3 a) b)] (Vector3 a))
copies a Vector3
.
cross
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c)] (Vector3 a))
(cross a b)
Compute the cross product of the two vectors x and y.
delete
template
(Fn [(Vector3 a)] ())
deletes a Vector3
. Should usually not be called manually.
dist
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c)] a)
(dist a b)
Get the distance between the vectors a and b.
div
defn
(Fn [(Ref (Vector3 a) b), a] (Vector3 a))
(div v n)
dot
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c)] a)
(dot a b)
Get the dot product of the two vectors x and y.
init
template
(Fn [a, a, a] (Vector3 a))
creates a Vector3
.
mag
defn
(Fn [(Ref (Vector3 a) b)] a)
(mag o)
Get the magnitude of a vector.
mag-sq
defn
(Fn [(Ref (Vector3 a) b)] a)
(mag-sq o)
Get the squared magnitude of a vector.
map
defn
(Fn [(Fn [a] b c), (Ref (Vector3 a) d)] (Vector3 b))
(map f v)
mul
defn
(Fn [(Ref (Vector3 a) b), a] (Vector3 a))
(mul v n)
neg
defn
(Fn [(Ref (Vector3 a) b)] (Vector3 a))
(neg a)
normalize
defn
(Fn [(Ref (Vector3 a) b)] (Vector3 a))
(normalize o)
Normalize a vector.
parallel?
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c)] Bool)
(parallel? a b)
Check whether the two vectors a and b are parallel.
perpendicular?
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c)] Bool)
(perpendicular? a b)
Check whether the two vectors a and b are perpendicular.
prn
template
(Fn [(Ref (Vector3 a) b)] String)
converts a Vector3
to a string.
random
defn
(Fn [] (Vector3 a))
(random)
set-x
template
(Fn [(Vector3 a), a] (Vector3 a))
sets the x
property of a Vector3
.
set-x!
template
(Fn [(Ref (Vector3 a) b), a] ())
sets the x
property of a Vector3
in place.
set-y
template
(Fn [(Vector3 a), a] (Vector3 a))
sets the y
property of a Vector3
.
set-y!
template
(Fn [(Ref (Vector3 a) b), a] ())
sets the y
property of a Vector3
in place.
set-z
template
(Fn [(Vector3 a), a] (Vector3 a))
sets the z
property of a Vector3
.
set-z!
template
(Fn [(Ref (Vector3 a) b), a] ())
sets the z
property of a Vector3
in place.
str
template
(Fn [(Ref (Vector3 a) b)] String)
converts a Vector3
to a string.
sub
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c)] (Vector3 a))
(sub a b)
sum
defn
(Fn [(Ref (Vector3 a) b)] a)
(sum o)
update-x
instantiate
(Fn [(Vector3 a), (Ref (Fn [a] a b) c)] (Vector3 a))
updates the x
property of a (Vector3 f)
using a function f
.
update-y
instantiate
(Fn [(Vector3 a), (Ref (Fn [a] a b) c)] (Vector3 a))
updates the y
property of a (Vector3 f)
using a function f
.
update-z
instantiate
(Fn [(Vector3 a), (Ref (Fn [a] a b) c)] (Vector3 a))
updates the z
property of a (Vector3 f)
using a function f
.
vapprox
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c)] Bool)
(vapprox a b)
Check whether the vectors a and b are approximately equal.
vlerp
defn
(Fn [(Ref (Vector3 a) b), (Ref (Vector3 a) c), a] (Vector3 a))
(vlerp a b amnt)
Linearly interpolate between the two vectors a and b by amnt (between 0 and 1).
vreduce
defn
(Fn [(Fn [a, b] a c), a, (Ref (Vector3 b) d)] a)
(vreduce f i v)
x
instantiate
(Fn [(Ref (Vector3 a) b)] (Ref a b))
gets the x
property of a Vector3
.
y
instantiate
(Fn [(Ref (Vector3 a) b)] (Ref a b))
gets the y
property of a Vector3
.
z
instantiate
(Fn [(Ref (Vector3 a) b)] (Ref a b))
gets the z
property of a Vector3
.
zero
defn
(Fn [] (Vector3 a))
(zero)
zip
defn
(Fn [(Fn [a, b] c d), (Ref (Vector3 a) e), (Ref (Vector3 b) f)] (Vector3 c))
(zip f a b)