Vectors with 2 Dimensions. Utilises underlying google vector code.
Vectors with 2 Dimensions. Utilises underlying google vector code.
The fuzzy zone size for the almost comparitor
The fuzzy zone size for the almost comparitor
(abs v)
Returns a vector that is a flipped and mirrored version of v, such that it appears in the positive quadrant
Returns a vector that is a flipped and mirrored version of v, such that it appears in the positive quadrant
(add v0 v1)
Returns a new vec2 which is v0 + v1
Returns a new vec2 which is v0 + v1
(almost v0 v1)
(almost v0 v1 & args)
Returns true if all the vectors passed in are so close they are almost equal. This is for dealing with precision problems in comparison.
Returns true if all the vectors passed in are so close they are almost equal. This is for dealing with precision problems in comparison.
(angle-between v1 v2)
Placing the tails of the two vectors together, return the angle between them in radians
Placing the tails of the two vectors together, return the angle between them in radians
(direction v0 v1)
returns a unit vector indicating the direction from the tip of v0, to the tip of v1
returns a unit vector indicating the direction from the tip of v0, to the tip of v1
Return the distance between the tip of v0 and the tip of v1
Return the distance between the tip of v0 and the tip of v1
Return the distance squared between the tip of v0 and the tip of v1
Return the distance squared between the tip of v0 and the tip of v1
(dot v0 v1)
Returns the dot product of v0 and v1
Returns the dot product of v0 and v1
Returns true is both v0 and v1 point in the same direction and are of the same length
Returns true is both v0 and v1 point in the same direction and are of the same length
(heading v)
horrible function you shouldn't really use. Just keep working with vectors directly. Returns the angle of the vector. Answers always between 0 and 2*PI
horrible function you shouldn't really use. Just keep working with vectors directly. Returns the angle of the vector. Answers always between 0 and 2*PI
(lerp v0 v1 f)
linearly interperet a vector between v0 and v1. f is the factor along the interpolation. f=0 is v0. f=1 is v1. f can extend outside 0 and 1
linearly interperet a vector between v0 and v1. f is the factor along the interpolation. f=0 is v0. f=1 is v1. f can extend outside 0 and 1
Return the length squared of vector v
Return the length squared of vector v
Return the zero two dimensional vector #<0,0>
Return the zero two dimensional vector #<0,0>
(random)
return a random vector that fits entirely in the unit circle, that is, whose length is always less than or equal to one.
return a random vector that fits entirely in the unit circle, that is, whose length is always less than or equal to one.
(random-unit)
Return a vector pointing in a random direction, but of exactly unit length
Return a vector pointing in a random direction, but of exactly unit length
(rotate v ang)
return a vector identical to v but rotated ang radians. On a maths axis (+ve y points up) +ve ang rotation is anticlockwise. On a screen axis (+ve y points down) +ve ang rotation is clockwise.
return a vector identical to v but rotated ang radians. On a maths axis (+ve y points up) +ve ang rotation is anticlockwise. On a screen axis (+ve y points down) +ve ang rotation is clockwise.
(rotate-90 v)
calls rotate but is hardcoded 90 degrees. Avoids calling cos and sin
calls rotate but is hardcoded 90 degrees. Avoids calling cos and sin
(rotated-pos? v1 v2)
return true if the second vector is angled as if rotated to the positive side of the first vector. Good for finding out which side of something another thing is on. In a maths axis (+ve y), 'pos' is to the left of v1. On a screen axis, 'pos' is to the right of v1.
return true if the second vector is angled as if rotated to the positive side of the first vector. Good for finding out which side of something another thing is on. In a maths axis (+ve y), 'pos' is to the left of v1. On a screen axis, 'pos' is to the right of v1.
(scale v scalar)
Returns a vector that is v, multiplied by the scalar.
Returns a vector that is v, multiplied by the scalar.
(scale-div v scalar)
Returns a vector that is v, divided by the scalar.
Returns a vector that is v, divided by the scalar.
(sub v)
(sub v0 v1)
Passed one arg, returns a vector that is equal and opposite to v, 180 degrees around. Passed two args, returns a vector that is equal to v0 - v1
Passed one arg, returns a vector that is equal and opposite to v, 180 degrees around. Passed two args, returns a vector that is equal to v0 - v1
(unit v)
Returns a unit vector that points in the same direction as v
Returns a unit vector that points in the same direction as v
Create a two dimensional vector #<x,y>
Create a two dimensional vector #<x,y>
Return the zero two dimensional vector #<0,0>
Return the zero two dimensional vector #<0,0>
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close