| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Waterfall.TwoD.Transforms
Contents
Synopsis
- class Transformable2D a
- matTransform2D :: Transformable2D a => M23 Double -> a -> a
- rotate2D :: Transformable2D a => Double -> a -> a
- scale2D :: Transformable2D a => V2 Double -> a -> a
- uScale2D :: Transformable2D a => Double -> a -> a
- translate2D :: Transformable2D a => V2 Double -> a -> a
- mirror2D :: Transformable2D a => V2 Double -> a -> a
- _translated2D :: Transformable2D t => V2 Double -> Iso' t t
- _scaled2D :: Transformable2D t => V2 Double -> Maybe (Iso' t t)
- _uScaled2D :: Transformable2D t => Double -> Maybe (Iso' t t)
- _rotated2D :: Transformable2D t => Double -> Iso' t t
- _mirrored2D :: Transformable2D t => V2 Double -> Iso' t t
Transformations
class Transformable2D a Source #
Typeclass for objects that can be manipulated in 2D space
Minimal complete definition
matTransform2D, rotate2D, scale2D, uScale2D, translate2D, mirror2D
Instances
| Transformable2D Diagram Source # | |
| Transformable2D RawDiagram Source # | |
Defined in Waterfall.TwoD.Transforms Methods matTransform2D :: M23 Double -> RawDiagram -> RawDiagram Source # rotate2D :: Double -> RawDiagram -> RawDiagram Source # scale2D :: V2 Double -> RawDiagram -> RawDiagram Source # uScale2D :: Double -> RawDiagram -> RawDiagram Source # translate2D :: V2 Double -> RawDiagram -> RawDiagram Source # mirror2D :: V2 Double -> RawDiagram -> RawDiagram Source # | |
| Transformable2D Path2D Source # | |
| Transformable2D Shape Source # | |
Defined in Waterfall.TwoD.Transforms | |
| Transformable2D (V2 Double) Source # | |
Defined in Waterfall.TwoD.Transforms | |
matTransform2D :: Transformable2D a => M23 Double -> a -> a Source #
Directly transform with a transformation matrix
rotate2D :: Transformable2D a => Double -> a -> a Source #
Rotate by an angle (in radians) about the origin
scale2D :: Transformable2D a => V2 Double -> a -> a Source #
Scale by different amounts along the x and y axes
uScale2D :: Transformable2D a => Double -> a -> a Source #
Scale uniformly along both axes
translate2D :: Transformable2D a => V2 Double -> a -> a Source #
Translate by a distance in 2D space
mirror2D :: Transformable2D a => V2 Double -> a -> a Source #
Mirror in the line, which passes through the origin, perpendicular to the specified vector
Note that in order to maintain consistency with Transformable,
the mirror is in the line perpendicular to the vector, not in the line parallel to the vector
Optics
_translated2D :: Transformable2D t => V2 Double -> Iso' t t Source #
Every translation is an isomorphism
_scaled2D :: Transformable2D t => V2 Double -> Maybe (Iso' t t) Source #
A scale by v as an isomorphism
Returns Nothing when any component of v is (near) zero,
as a scale that collapses an axis has no inverse.
_uScaled2D :: Transformable2D t => Double -> Maybe (Iso' t t) Source #
A scale by s as an isomorphism
Returns Nothing when s is (near) zero,
as a scale that collapses everything to the origin has no inverse.
_rotated2D :: Transformable2D t => Double -> Iso' t t Source #
Every rotation is an isomorphism
_mirrored2D :: Transformable2D t => V2 Double -> Iso' t t Source #
Every mirror is an isomorphism