Module

# GLMatrix.Vec2

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

### #Vec2Source

``data Vec2 :: Type``

#### Instances

• `Show Vec2`
• `Eq Vec2`

``add :: Vec2 -> Vec2 -> Vec2``

### #angleSource

``angle :: Vec2 -> Vec2 -> Number``

Get the angle between two 2D vectors

### #ceilSource

``ceil :: Vec2 -> Vec2``

Math.ceil the components of a vec2

### #crossSource

``cross :: Vec2 -> Vec2 -> Vec3``

### #distanceSource

``distance :: Vec2 -> Vec2 -> Number``

Calculates the euclidian distance between two vec2's

### #divideSource

``divide :: Vec2 -> Vec2 -> Vec2``

Divides two vec2's

### #dotSource

``dot :: Vec2 -> Vec2 -> Number``

Calculates the dot product of two vec2's

### #equalsSource

``equals :: Vec2 -> Vec2 -> Boolean``

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

### #floorSource

``floor :: Vec2 -> Vec2``

Math.floor the components of a vec2

### #fromValuesSource

``fromValues :: Number -> Number -> Vec2``

Creates a new vec2 initialized with the given values

### #inverseSource

``inverse :: Vec2 -> Vec2``

Returns the inverse of the components of a vec2

### #lengthSource

``length :: Vec2 -> Number``

Calculates the length of a vec2

### #lerpSource

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

Performs a linear interpolation between two vec2's

### #maxSource

``max :: Vec2 -> Vec2 -> Vec2``

Returns the maximum of two vec2's

### #minSource

``min :: Vec2 -> Vec2 -> Vec2``

Returns the minimum of two vec2's

### #multiplySource

``multiply :: Vec2 -> Vec2 -> Vec2``

Multiplies two vec2's

### #negateSource

``negate :: Vec2 -> Vec2``

Negates the components of a vec2

### #normalizeSource

``normalize :: Vec2 -> Vec2``

Normalize a vec2

### #rotateSource

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

Rotate a 2D vector

### #roundSource

``round :: Vec2 -> Vec2``

Math.round the components of a vec2

### #scaleSource

``scale :: Vec2 -> Number -> Vec2``

Scales a vec2 by a scalar number

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

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

### #squaredDistanceSource

``squaredDistance :: Vec2 -> Vec2 -> Number``

Calculates the squared euclidian distance between two vec2's

### #squaredLengthSource

``squaredLength :: Vec2 -> Number``

Calculates the squared length of a vec2

### #subtractSource

``subtract :: Vec2 -> Vec2 -> Vec2``

Subtracts vector b from vector a

### #transformMat3Source

``transformMat3 :: Vec2 -> Mat3 -> Vec2``

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

### #zeroSource

``zero :: Vec2``

``numbers :: Vec2 -> Array Number``

Extract a number array

### #mapSource

``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 :: Partial => Array Number -> Vec2``

Create a vector from an array produced by `numbers`.

### #zipWithSource

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

### #sliceSource

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

Like `Array.slice`