Module

# Data.Vector.Polymorphic

Package
purescript-polymorphic-vectors
Repository
3ddyy/purescript-polymorphic-vectors

### #makeRectSource

``makeRect :: forall a. a -> a -> a -> a -> Rect a``

Constructs a `Rect` from four values

### #lengthSource

``length :: forall p. ToPos Number p => p -> Number``

Get the length of a position vector

### #diagonalSource

``diagonal :: forall s. ToSize Number s => s -> Number``

Get the diagonal of a size

### #insideSource

``inside :: forall r p n. ToRegion n r => ToPos n p => Ord n => Semiring n => r -> p -> Boolean``

Checks if a position is inside a region. Size of the region should be positive. Inclusive on the lower bound, exclusive on the higher bound.

### #outsideSource

``outside :: forall r p n. ToRegion n r => ToPos n p => Ord n => Semiring n => r -> p -> Boolean``

`inside`, but with its result negated.

### #putInsideModSource

``putInsideMod :: forall r p n. ToRegion n r => AsPosEndo n p => EuclideanRing n => r -> p -> p``

Put a position inside a region by using the modulus operator

### #areaSource

``area :: forall s n. ToSize n s => Semiring n => s -> n``

Get the area of a size

### #perimeterSource

``perimeter :: forall s n. ToSize n s => Semiring n => s -> n``

Get the perimeter of a size

### #ratioSource

``ratio :: forall s n. ToSize n s => EuclideanRing n => s -> n``

Get the ratio of a size by dividing the width by the height

### #midPosSource

``midPos :: forall s p n. ToRegion n s => FromPos n p => EuclideanRing n => s -> p``

Get the center position of a region

### #dotSource

``dot :: forall p n. ToPos n p => Semiring n => p -> p -> n``

Get the dot product of two vectors

### #perpendicularSource

``perpendicular :: forall p n. ToPos n p => Semiring n => Eq n => p -> p -> Boolean``

Check if two vectors are perpendicular

### #parallelSource

``parallel :: forall p n. ToPos n p => EuclideanRing n => Eq n => p -> p -> Boolean``

Check if two vectors are parallel

### #toRectangleWithSource

``toRectangleWith :: forall n r. ToRegion n r => Semiring n => (n -> Number) -> r -> Rectangle``

Turn a region into a `Rectangle`

### #toRectangleSource

``toRectangle :: forall r. ToRegion Number r => r -> Rectangle``

Turn a rection represented with `Number`s into a `Rectangle`

## Re-exports from Data.Vector.Polymorphic.Types

### #Vector2Source

``data Vector2 a``

#### Constructors

• `Vector2 a a`

#### Instances

• `(Eq a) => Eq (Vector2 a)`
• `(Ord a) => Ord (Vector2 a)`
• `(Show a) => Show (Vector2 a)`
• `Functor Vector2`
• `Apply Vector2`
• `Applicative Vector2`
• `(Semigroup a) => Semigroup (Vector2 a)`
• `(Monoid a) => Monoid (Vector2 a)`
• `(Semiring a) => Semiring (Vector2 a)`

### #RectSource

``data Rect a``

#### Constructors

• `Rect (Vector2 a) (Vector2 a)`

#### Instances

• `(Eq a) => Eq (Rect a)`
• `(Ord a) => Ord (Rect a)`
• `(Show a) => Show (Rect a)`
• `Functor Rect`
• `Apply Rect`
• `Applicative Rect`
• `(Semigroup a) => Semigroup (Rect a)`
• `(Monoid a) => Monoid (Rect a)`
• `(Semiring a) => Semiring (Rect a)`

### #(><)Source

Operator alias for Data.Vector.Polymorphic.Types.Vector2 (non-associative / precedence 2)