Liking cljdoc? Tell your friends :D

somekit.vec

A collection of vector functions. Vectors are treated both like collections and directions.

A collection of vector functions. Vectors are treated both like collections
and directions.
raw docstring

addcljs

(add v1 v2)

adds two vectors of same dimension together

adds two vectors of same dimension together
sourceraw docstring

add-scalarcljs

(add-scalar v scalar)

Adds a scalar to a vector

Adds a scalar to a vector
sourceraw docstring

anglecljs

(angle v)

Returns angle of a 2D vector

Returns angle of a 2D vector
sourceraw docstring

angle-betweencljs

(angle-between v1 v2)

Calculates the angle between two 2D Vectors using angle difference.

Calculates the angle between two 2D Vectors using angle difference.
sourceraw docstring

averagecljs

(average v)

calculates the average of the vector

calculates the average of the vector
sourceraw docstring

distancecljs

(distance v1 v2)

Calculates distance between two vectors of same dimension

Calculates distance between two vectors of same dimension
sourceraw docstring

divcljs

(div v1 v2)

Divides one vector by another. Both must be same dimension.

Divides one vector by another. Both must be same dimension.
sourceraw docstring

div-scalarcljs

(div-scalar v scalar)

Divides vector by a scalar

Divides vector by a scalar
sourceraw docstring

dotcljs

(dot v1 v2)

Dot product of two vectors

Dot product of two vectors
sourceraw docstring

dx->xcljs

(dx->x list start)
source

from-anglecljs

(from-angle theta)

Returns a 2D unit vector with given angle

Returns a 2D unit vector with given angle
sourceraw docstring

from-polarcljs

(from-polar theta radius)

Returns a 2D vector from polar coordinates

Returns a 2D vector from polar coordinates
sourceraw docstring

indexedcljs

(indexed coll)

pairs each element in a collection as an indexed tuple and return as vector

pairs each element in a collection as
an indexed tuple and return as vector
sourceraw docstring

lengthcljs

(length v)

Returns the length of a vector of any dimension.

Returns the length of a vector of any dimension.
sourceraw docstring

lerpcljs

(lerp v1 v2 t)

Lerps between two vectors

Lerps between two vectors
sourceraw docstring

limitcljs

(limit v l)

If vector v is bigger than limit l, vector gets scaled to l.

If vector v is bigger than limit l, vector gets scaled to l.
sourceraw docstring

mat-transcljs

(mat-trans mat)

Rotates an ND matrix (vec of vecs)

Rotates an ND matrix (vec of vecs)
sourceraw docstring

mulcljs

(mul v1 v2)

Multiplied two vectors of same dimensions

Multiplied two vectors of same dimensions
sourceraw docstring

mul-scalarcljs

(mul-scalar v scalar)

Multiplies vector by a scalar

Multiplies vector by a scalar
sourceraw docstring

normalizecljs

(normalize v)

Returns a vector of any dimension normalized

Returns a vector of any dimension normalized
sourceraw docstring

normalize-rangecljs

(normalize-range list)

Divides every element in vector by total sum

Divides every element in vector by total sum
sourceraw docstring

padcljs

(pad vector value)
(pad vector value pad-size)

pads start and end of vector with value and pad size

pads start and end of vector with value and pad size
sourceraw docstring

pad-endcljs

(pad-end vector value)
(pad-end vector value pad-size)

pads end of vector with value and pad size

pads end of vector with value and pad size
sourceraw docstring

pad-startcljs

(pad-start vector value)
(pad-start vector value pad-size)

pads start of vector with value and pad size

pads start of vector with value and pad size
sourceraw docstring

pad-wrapcljs

(pad-wrap vector)

pads start of vector with end and end of vector with start

pads start of vector with end and end of vector with start
sourceraw docstring

randomcljs

(random N)
(random N f)

Returns a random vector of N dimension. Values between 0 and 1. An optional second argument can be given as another RNG function.

Returns a random vector of N dimension. Values between 0 and 1.
An optional second argument can be given as another RNG function.
sourceraw docstring

random-polarcljs

(random-polar)
(random-polar f)

Returns a 2D vector from a random angle and radius between 0 and 1. An optional second argument can be given as another RNG function.

Returns a 2D vector from a random angle and radius between 0 and 1.
An optional second argument can be given as another RNG function.
sourceraw docstring

random-replacecljs

(random-replace vec value)
(random-replace vec value f)

Replace random element in vector with a value

Replace random element in vector with a value
sourceraw docstring

random10cljs

(random10 N)
(random10 N f)

Returns a vector of size N of random 1s and 0s. An optional second argument can be given as another RNG function.

Returns a vector of size N of random 1s and 0s.
An optional second argument can be given as another RNG function.
sourceraw docstring

range-fillcljs

(range-fill vec start stop value)

fill range of elements in vector with value

fill range of elements in vector with value
sourceraw docstring

range-replacecljs

(range-replace vec value position)

replace elements of vector with another set at given position

replace elements of vector with another set at given position
sourceraw docstring

restvcljs

(restv col)

returns the rest of a collection as a vector

returns the rest of a collection as a vector
sourceraw docstring

rotatecljs

(rotate v theta)

rotates a 2D vector by an angle

rotates a 2D vector by an angle
sourceraw docstring

selectcljs

(select v a b)

Returns the selection of a vector from index a to and including index b.

Returns the selection of a vector from index a to and including index b.
sourceraw docstring

set-lengthcljs

(set-length v l)

Returns the vector v with given length l.

Returns the vector v with given length l.
sourceraw docstring

splitcljs

(split v i)

Return two collections split from a vector with i as the index starting the second group.

Return two collections split from a vector with i as the index
starting the second group.
sourceraw docstring

subcljs

(sub v1 v2)

Substracts 2 vectors of same dimension

Substracts 2 vectors of same dimension
sourceraw docstring

sub-scalarcljs

(sub-scalar v scalar)

Subtracts scalar from vector

Subtracts scalar from vector
sourceraw docstring

sumcljs

(sum v)

Returns the sum of all elements in a vector

Returns the sum of all elements in a vector
sourceraw docstring

vec2cljs

(vec2 value)

Creates a 2d vector of given value

Creates a 2d vector of given value
sourceraw docstring

vec3cljs

(vec3 value)

Creates a 3d vector of given value

Creates a 3d vector of given value
sourceraw docstring

vec4cljs

(vec4 value)

Creates a 4d vector of given value

Creates a 4d vector of given value
sourceraw docstring

vecncljs

(vecn value n)

Creates an n-dimensional vector of given value

Creates an n-dimensional vector of given value
sourceraw docstring

zeroscljs

(zeros n)

Creates an n-dimensional vector of zeroes

Creates an n-dimensional vector of zeroes
sourceraw docstring

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

× close