Module

GLMatrix.Vec2

Package
purescript-gl-matrix
Repository
dirkz/purescript-gl-matrix

#Vec2 Source

data Vec2 :: Type

Instances

#add Source

add :: Vec2 -> Vec2 -> Vec2

Adds two vec2's

#angle Source

angle :: Vec2 -> Vec2 -> Number

Get the angle between two 2D vectors

#ceil Source

ceil :: Vec2 -> Vec2

Math.ceil the components of a vec2

#cross Source

cross :: Vec2 -> Vec2 -> Vec3

#distance Source

distance :: Vec2 -> Vec2 -> Number

Calculates the euclidian distance between two vec2's

#divide Source

divide :: Vec2 -> Vec2 -> Vec2

Divides two vec2's

#dot Source

dot :: Vec2 -> Vec2 -> Number

Calculates the dot product of two vec2's

#equals Source

equals :: Vec2 -> Vec2 -> Boolean

Returns whether or not the vectors have approximately the same elements in the same position

#floor Source

floor :: Vec2 -> Vec2

Math.floor the components of a vec2

#fromValues Source

fromValues :: Number -> Number -> Vec2

Creates a new vec2 initialized with the given values

#inverse Source

inverse :: Vec2 -> Vec2

Returns the inverse of the components of a vec2

#length Source

length :: Vec2 -> Number

Calculates the length of a vec2

#lerp Source

lerp :: Vec2 -> Vec2 -> Number -> Vec2

Performs a linear interpolation between two vec2's

#max Source

max :: Vec2 -> Vec2 -> Vec2

Returns the maximum of two vec2's

#min Source

min :: Vec2 -> Vec2 -> Vec2

Returns the minimum of two vec2's

#multiply Source

multiply :: Vec2 -> Vec2 -> Vec2

Multiplies two vec2's

#negate Source

negate :: Vec2 -> Vec2

Negates the components of a vec2

#normalize Source

normalize :: Vec2 -> Vec2

Normalize a vec2

#rotate Source

rotate :: Vec2 -> Vec2 -> Number -> Vec2

Rotate a 2D vector

#round Source

round :: Vec2 -> Vec2

Math.round the components of a vec2

#scale Source

scale :: Vec2 -> Number -> Vec2

Scales a vec2 by a scalar number

#scaleAndAdd Source

scaleAndAdd :: Vec2 -> Vec2 -> Number -> Vec2

Adds two vec2's after scaling the second operand by a scalar value

#squaredDistance Source

squaredDistance :: Vec2 -> Vec2 -> Number

Calculates the squared euclidian distance between two vec2's

#squaredLength Source

squaredLength :: Vec2 -> Number

Calculates the squared length of a vec2

#subtract Source

subtract :: Vec2 -> Vec2 -> Vec2

Subtracts vector b from vector a

#transformMat3 Source

transformMat3 :: Vec2 -> Mat3 -> Vec2

Transforms the vec2 with a mat3 3rd vector component is implicitly '1'

#numbers Source

numbers :: Vec2 -> Array Number

Extract a number array

#map Source

map :: (Number -> Number) -> Vec2 -> Vec2

Map a function from Number to Number over it. Note: Since this is not a general container, it cannot be a Functor.

#unsafeFromNumbers Source

unsafeFromNumbers :: Partial => Array Number -> Vec2

Create a vector from an array produced by numbers.

#zipWith Source

zipWith :: (Number -> Number -> Number) -> Vec2 -> Vec2 -> Vec2

#slice Source

slice :: Int -> Int -> Vec2 -> Array Number

Like Array.slice