Liking cljdoc? Tell your friends :D

infinitelives.utils.vec2

Vectors with 2 Dimensions. Utilises underlying google vector code.

Vectors with 2 Dimensions. Utilises underlying google vector code.
raw docstring

*almost-delta*cljs

The fuzzy zone size for the almost comparitor

The fuzzy zone size for the almost comparitor
sourceraw docstring

abscljs

(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
sourceraw docstring

addcljs

(add v0 v1)

Returns a new vec2 which is v0 + v1

Returns a new vec2 which is v0 + v1
sourceraw docstring

almostcljs

(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.
sourceraw docstring

angle-betweencljs

(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
sourceraw docstring

as-vectorcljs

(as-vector v)
source

directioncljs

(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
sourceraw docstring

distancecljs

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
sourceraw docstring

distance-squaredcljs

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
sourceraw docstring

dotcljs

(dot v0 v1)

Returns the dot product of v0 and v1

Returns the dot product of v0 and v1
sourceraw docstring

equalscljs

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
sourceraw docstring

get-xcljs

(get-x v)
source

get-ycljs

(get-y v)
source

headingcljs

(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
sourceraw docstring

lerpcljs

(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
sourceraw docstring

magnitudecljs

Return the length of vector v

Return the length of vector v
sourceraw docstring

magnitude-squaredcljs

Return the length squared of vector v

Return the length squared of vector v
sourceraw docstring

makecljs

Return the zero two dimensional vector #<0,0>

Return the zero two dimensional vector #<0,0>
sourceraw docstring

randomcljs

(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.
sourceraw docstring

random-unitcljs

(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
sourceraw docstring

rotatecljs

(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.
sourceraw docstring

rotate-90cljs

(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
sourceraw docstring

rotated-pos?cljs

(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.
sourceraw docstring

scalecljs

(scale v scalar)

Returns a vector that is v, multiplied by the scalar.

Returns a vector that is v, multiplied by the scalar.
sourceraw docstring

scale-divcljs

(scale-div v scalar)

Returns a vector that is v, divided by the scalar.

Returns a vector that is v, divided by the scalar.
sourceraw docstring

subcljs

(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
sourceraw docstring

truncatecljs

(truncate v scalar)
source

unitcljs

(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
sourceraw docstring

vec2cljs

Create a two dimensional vector #<x,y>

Create a two dimensional vector #<x,y>
sourceraw docstring

zerocljs

Return the zero two dimensional vector #<0,0>

Return the zero two dimensional vector #<0,0>
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close