on master help sign in
Correct the scaleY function, get rid of a 3x3 matrix in docs, use 3x3 matrices in multiply docs to clarify how two 3x2 matrices can be multiplied
65509d7Evan Czaplicki
libraries/Transform2D.elm+10−10
@@ -31,12 +31,12 @@ identity = Native.Transform2D.identity
31{-| Creates a transformation matrix. This lets you create transforms
31{-| Creates a transformation matrix. This lets you create transforms
32such as scales, shears, reflections, and translations.
32such as scales, shears, reflections, and translations.
33
33
34− matrix a b c d dx dy
34+ matrix a b c d x y
35
35
36− / a b dx \
36+ / a b x \
37− \ c d dy /
37+ \ c d y /
38
38
39−Note that `dx` and `dy` are the translation values.
39+Note that `x` and `y` are the translation values.
40-}
40-}
41matrix : Float -> Float -> Float -> Float -> Float -> Float -> Transform2D
41matrix : Float -> Float -> Float -> Float -> Float -> Float -> Transform2D
42matrix = Native.Transform2D.matrix
42matrix = Native.Transform2D.matrix
@@ -55,8 +55,7 @@ rotation = Native.Transform2D.rotation
55 translation x y
55 translation x y
56
56
57 / 1 0 x \
57 / 1 0 x \
58− | 0 1 y |
58+ \ 0 1 y /
59− \ 0 0 1 /
60-}
59-}
61translation : Float -> Float -> Transform2D
60translation : Float -> Float -> Transform2D
62translation x y = matrix 1 0 0 1 x y
61translation x y = matrix 1 0 0 1 x y
@@ -77,14 +76,15 @@ scaleX x = matrix x 0 0 1 0 0
77
76
78{-| Creates a transformation for vertical scaling -}
77{-| Creates a transformation for vertical scaling -}
79scaleY : Float -> Transform2D
78scaleY : Float -> Transform2D
80−scaleY y = matrix y 0 0 1 0 0
79+scaleY y = matrix 1 0 0 y 0 0
81
80
82{-| Multiplies two transforms together:
81{-| Multiplies two transforms together:
83
82
84− multiply a b
83+ multiply m n
85
84
86− / a11 a12 \ . / b11 b12 \
85+ / ma mb mx \ / na nb nx \
87− \ a21 a22 / \ b21 b22 /
86+ | mc md my | . | nc nd ny |
87+ \ 0 0 1 / \ 0 0 1 /
88-}
88-}
89multiply : Transform2D -> Transform2D -> Transform2D
89multiply : Transform2D -> Transform2D -> Transform2D
90multiply = Native.Transform2D.multiply
90multiply = Native.Transform2D.multiply