Cartesian- Coordinate systems

Copyright(c) Jonatan H Sundqvist 2016
MaintainerJonatan H Sundqvist
PortabilityPOSIX (not sure)
Safe HaskellNone









overlap :: Ord n => (n, n) -> (n, n) -> Maybe (n, n) Source #

Finds the overlap between two ranges (lower bound, upper bound). | Yields the overlap of two closed intervals (n ∈ R) TODO: Normalise intervals (eg. (12, 5) -> (5, 12)) TODO: Type for intervals (which would also encode the openness of the lower and upper limits)

fromCorners :: (Applicative v, Num n, Ord n) => v n -> v n -> BoundingBox (v n) Source #

Cross product cross :: (Vector v, Num f) => v f -> v f -> v f cross a b = _

Euclidean distance between two points euclidean :: (Vector v, Floating f) => v f -> v f -> f euclidean a b = sqrt $ dot a b

Vector -> (magnitude, argument) polar :: (Floating a, Eq a) => Vector a -> (a, a) polar v@(Vector x y) = (magnitude v, argument v)

Creates a bounding box from two opposite corners TODO: Better name (?) TODO: Don't make assumptions about WHICH corners they are (✓) TODO: Should we care about degenerate cases (such as a and b being identical)

fromExtents :: (Applicative v, Num n) => Axes v n -> BoundingBox (v n) Source #

Top Left Bottom Right

intersect :: (Applicative v, Traversable v, Ord n, Num n) => BoundingBox (v n) -> BoundingBox (v n) -> Maybe (BoundingBox (v n)) Source #

Finds the intersection (boolean AND) of two bounding boxes