Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Affine2d
, Mat2x2
and V2
as a SemigroupAction
instance.
Affine2d
or Mat2x2
represents \(f: x \rightarrow a x + b\). V2
is the target vector type
with scaling information.
REMARK: It is super important to have 1
as the second element in V2
. Or else it fails to
calculate comopsitional affine transformation.
Synopsis
- newtype Affine2d a = Affine2d (Affine2dRepr a)
- identAffine2d :: Num a => Affine2d a
- type Affine2dRepr a = (a, a)
- newtype Mat2x2 a = Mat2x2 (Mat2x2Repr a)
- type Mat2x2Repr a = (a, a, a, a)
- toMat2x2 :: Num a => a -> a -> Mat2x2 a
- unMat2x2 :: Mat2x2 a -> (a, a, a, a)
- mapM22 :: (a -> b) -> Mat2x2 a -> Mat2x2 b
- mulM22M22 :: Num a => Mat2x2 a -> Mat2x2 a -> Mat2x2 a
- invMat2x2 :: Fractional e => Mat2x2 e -> Mat2x2 e
- mulM22V2 :: Num a => Mat2x2 a -> V2 a -> V2 a
- newtype V2 a = V2 (V2Repr a)
- type V2Repr a = (a, a)
- toV2 :: Num a => a -> V2 a
- unV2 :: V2 a -> a
- mapV2 :: (a -> b) -> V2 a -> V2 b
Documentation
2D affine transformation \(f: x \rightarrow a x + b\)
The acted target type is V2
, which holds the length at the second element.
Composition and dual
\((f_1 \diamond f_2) v := (f_1 . f_2) v\). If yo need foldr [f_l, .., f_r] on segment tree, be
sure to wrap Affine2d
with Dual
.
Affine2d (Affine2dRepr a) |
Instances
identAffine2d :: Num a => Affine2d a #
type Affine2dRepr a = (a, a) #
Affine2d
represents x -> a x + b
.
SegmentAction implementations
SemigroupAction implementations
Mat2x2 (Mat2x2Repr a) |
Instances
type Mat2x2Repr a = (a, a, a, a) #
Mat2x2
internal unboxed data representaton.
invMat2x2 :: Fractional e => Mat2x2 e -> Mat2x2 e #
\(O(N^2)\) Returns NxN unit matrix, based on Group
and Fractional
.
Two-dimensional unboxed vector. Implements `Semigroup V2` as sum.
Instances
V2
internal unboxed data representaton. Be sure to have 1
as the second element on
construction.