packages feed

linear 1.17.1 → 1.18

raw patch · 5 files changed

+47/−33 lines, 5 filesdep +base-orphansdep ~basedep ~filepath

Dependencies added: base-orphans

Dependency ranges changed: base, filepath

Files

CHANGELOG.markdown view
@@ -1,3 +1,12 @@+1.18+----+* Consolidated `eye2` .. `eye4` into a single `identity` combinator.+* Fixed the `Data` instance `V n a` for GHC 7.10-RC3.++1.17.1.1+--------+* `filepath` 1.4 support+ 1.17.1 ------ * Added support for `Data.Functor.Classes` from `transformers` 0.5 via `transformers-compat`.
linear.cabal view
@@ -1,6 +1,6 @@ name:          linear category:      Math, Algebra-version:       1.17.1+version:       1.18 license:       BSD3 cabal-version: >= 1.8 license-file:  LICENSE@@ -89,7 +89,7 @@     base,     directory >= 1.0 && < 1.3,     doctest   >= 0.8 && < 0.10,-    filepath  >= 1.3 && < 1.4,+    filepath  >= 1.3 && < 1.5,     lens,     simple-reflect >= 0.3.1 
src/Linear/Matrix.hs view
@@ -23,7 +23,7 @@   , M22, M23, M24, M32, M33, M34, M42, M43, M44   , m33_to_m44, m43_to_m44   , det22, det33, det44, inv22, inv33, inv44-  , eye2, eye3, eye4+  , identity   , Trace(..)   , translation   , transpose@@ -221,32 +221,16 @@ m33_to_m44 (V3 r1 r2 r3) = V4 (vector r1) (vector r2) (vector r3) (point 0) {-# ANN m33_to_m44 "HLint: ignore Use camelCase" #-} --- |2x2 identity matrix.------ >>> eye2--- V2 (V2 1 0) (V2 0 1)-eye2 :: Num a => M22 a-eye2 = V2 (V2 1 0)-          (V2 0 1)---- |3x3 identity matrix.------ >>> eye3--- V3 (V3 1 0 0) (V3 0 1 0) (V3 0 0 1)-eye3 :: Num a => M33 a-eye3 = V3 (V3 1 0 0)-          (V3 0 1 0)-          (V3 0 0 1)---- |4x4 identity matrix.+-- |The identity matrix for any dimension vector. ----- >>> eye4+-- >>> identity :: M44 Int -- V4 (V4 1 0 0 0) (V4 0 1 0 0) (V4 0 0 1 0) (V4 0 0 0 1)-eye4 :: Num a => M44 a-eye4 = V4 (V4 1 0 0 0)-          (V4 0 1 0 0)-          (V4 0 0 1 0)-          (V4 0 0 0 1)+-- >>> identity :: V3 (V3 Int)+-- V3 (V3 1 0 0) (V3 0 1 0) (V3 0 0 1)+-- >>> identity :: V 2 (V 2 Int)+-- V (fromList [V (fromList [1, 0]), V (fromList [0, 1]))+identity :: (Num a, Traversable t, Applicative t) => t (t a)+identity = scaled (pure 1)  -- |Extract the translation vector (first three entries of the last -- column) from a 3x4 or 4x4 matrix.
src/Linear/Projection.hs view
@@ -90,8 +90,8 @@         b = tanHalfFovy         c = -(far - near) / (2 * far * near)         d = (far + near) / (2 * far * near)-  + -- | Build a perspective matrix per the classic @glFrustum@ arguments. frustum   :: Floating a@@ -102,13 +102,13 @@   -> a -- ^ Near   -> a -- ^ Far   -> M44 a-frustum l r b t n f = +frustum l r b t n f =   V4 (V4 x 0 a    0)      (V4 0 y e    0)      (V4 0 0 c    d)      (V4 0 0 (-1) 0)   where-    rml = r-l +    rml = r-l     tmb = t-b     fmn = f-n     x = 2*n/rml@@ -127,7 +127,7 @@   -> a -- ^ Near   -> a -- ^ Far   -> M44 a-inverseFrustum l r b t n f = +inverseFrustum l r b t n f =   V4 (V4 rx 0 0 ax)      (V4 0 ry 0 by)      (V4 0 0 0 (-1))@@ -184,7 +184,28 @@     ry = (t-b)*hrn     rw = -hrn --- | Build an orthographic perspective matrix from 6 clipping planes+-- | Build an orthographic perspective matrix from 6 clipping planes.+-- This matrix takes the region delimited by these planes and maps it+-- to normalized device coordinates between [-1,1]+--+-- This call is designed to mimic the parameters to the OpenGL @glOrtho@+-- call, so it has a slightly strange convention: Notably: the near and+-- far planes are negated.+--+-- Consequently:+--+-- @+-- 'ortho' l r b t n f !* 'V4' l b (-n) 1 = 'V4' (-1) (-1) (-1) 1+-- 'ortho' l r b t n f !* 'V4' r t (-f) 1 = 'V4' 1 1 1 1+-- @+--+-- Examples:+--+-- >>> ortho 1 2 3 4 5 6 !* V4 1 3 (-5) 1+-- V4 (-1.0) (-1.0) (-1.0) 1.0+--+-- >>> ortho 1 2 3 4 5 6 !* V4 2 4 (-6) 1+-- V4 1.0 1.0 1.0 1.0 ortho   :: Fractional a   => a -- ^ Left
src/Linear/V.hs view
@@ -368,7 +368,7 @@ vDataType = mkDataType "Linear.V.V" [vConstr] {-# NOINLINE vDataType #-} -instance (Dim n, Typeable n, Data a) => Data (V n a) where+instance (Typeable (V n), Typeable (V n a), Dim n, Data a) => Data (V n a) where   gfoldl f z (V as) = z (V . fromList) `f` V.toList as   toConstr _ = vConstr   gunfold k z c = case constrIndex c of