Module

Data.Vector.Polymorphic

Package
purescript-polymorphic-vectors
Repository
artemisSystem/purescript-polymorphic-vectors

#length Source

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

Get the length of a position vector

#diagonal Source

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

Get the diagonal of a size

#inside Source

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.

#outside Source

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

inside, but with its result negated.

#putInsideMod Source

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

#area Source

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

Get the area of a size

#perimeter Source

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

Get the perimeter of a size

#ratio Source

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

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

#midPos Source

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

Get the center position of a region

#dot Source

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

Get the dot product of two vectors

#perpendicular Source

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

Check if two vectors are perpendicular

#parallel Source

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

Check if two vectors are parallel

#convertPos Source

convertPos :: forall p1 p2 n. ToPos n p1 => FromPos n p2 => p1 -> p2

#convertSize Source

convertSize :: forall p1 p2 n. ToSize n p1 => FromSize n p2 => p1 -> p2

#convertRegion Source

convertRegion :: forall p1 p2 n. ToRegion n p1 => FromRegion n p2 => p1 -> p2

Re-exports from Data.Vector.Polymorphic.Types

#makeRect Source

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

Constructs a Rect from four values

#getY Source

getY :: forall a. Vector2 a -> a

Get the y value from a Vector2

#getX Source

getX :: forall a. Vector2 a -> a

Get the x value from a Vector2

#getSize Source

getSize :: forall a. Rect a -> Vector2 a

Get the size of a Rect

#getPos Source

getPos :: forall a. Rect a -> Vector2 a

Get the topleft position of a Rect

#(><) Source

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