Cartesian-0.6.0.0: Coordinate systems

Copyright (c) Jonatan H Sundqvist 2015 MIT Jonatan H Sundqvist experimental|stable POSIX (not sure) None Haskell2010

Cartesian.Lenses

Description

Synopsis

# Documentation

pinnedAxis :: Num n => n -> Simple Lens (Axis n) (Axis n) Source #

pad :: (Getter v f) -> f -> f -> BoundingBox v pad axis by direction = _

Like pinned, except it operates on a single axis and only focuses on the position (not size)

TODO: Change the type to make it play more nicely with pinned (?) TODO: - What's the proper way of lifting lenses (such as pinnedAxis), so they work on multiple fields. This is not mucher better than it used to be when we didn't have the pinnedAxis helper...

pinned :: (Applicative v, Num n) => v n -> Simple Lens (BoundingBox (v n)) (Axes v n) Source #

Creates a lens where a pin is placed on a given point (to), so that the box can be placed or resized relative to the pin. It is also useful for retrieving points within the box (such as the centre).

The pin is assumed to be normalised with respect to the corner and size of the box.

let box = BoundingBox { cornerOf = V2 10 24, sizeOf = V2 6 18 }

box^.pinned (V2 0.5 0.5) -- Anchored to the centre
> V2 (13.0,6.0) (33.0,18.0)


axis :: (Applicative v, Num n) => Simple Lens (Axes v n) (Axis n) -> Simple Lens (BoundingBox (v n)) (Axis n) Source #

Focuses on a single axis of the box

axes :: Applicative v => Lens (BoundingBox (v a)) (BoundingBox (v b)) (Axes v a) (Axes v b) Source #

extents :: (Applicative v, Num a, Num b) => Lens (BoundingBox (v a)) (BoundingBox (v b)) (Axes v a) (Axes v b) Source #

side :: (Applicative v, Num n) => Simple Lens (Axes v n) (Axis n) -> Simple Lens (Axis n) n -> Simple BoxLens v n Source #

TODO: Turn this into a lens function (?) TODO: Polish description TODO: Loosen constraint on n (✓) axes which.pinned (V1 step).x._1 -- lens get set

corner :: forall v. Lens' (BoundingBox v) v Source #

size :: forall v. Lens' (BoundingBox v) v Source #

Ugh...

begin :: Lens (Line v) (Line v) v v Source #

end :: Lens (Line v) (Line v) v v Source #

width :: HasX (v f) f => Simple Lens (BoundingBox (v f)) f Source #

height :: HasY (v f) f => Simple BoxLens v f Source #

depth :: HasZ (v f) f => Simple BoxLens v f Source #

left :: (Applicative v, HasX (Axes v n) (Axis n), Num n) => Simple BoxLens v n Source #

right :: (Applicative v, HasX (Axes v n) (Axis n), Num n) => Simple BoxLens v n Source #

bottom :: (Applicative v, HasY (Axes v n) (Axis n), Num n) => Simple BoxLens v n Source #

top :: (Applicative v, HasY (Axes v n) (Axis n), Num n) => Simple BoxLens v n Source #

front :: (Applicative v, HasZ (Axes v n) (Axis n), Num n) => Simple BoxLens v n Source #

back :: (Applicative v, HasZ (Axes v n) (Axis n), Num n) => Simple BoxLens v n Source #

centre :: (Applicative v, Fractional f) => Simple Lens (BoundingBox (v f)) (Axes v f) Source #

TODO: This should probably yield a vector (rename or redesign)

x :: HasX a f => Simple Lens a f Source #

y :: HasY a f => Simple Lens a f Source #

z :: HasZ a f => Simple Lens a f Source #