packages feed

linear 1.15.0.1 → 1.15.1

raw patch · 3 files changed

+25/−1 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Linear.Projection: inversePerspective :: Floating a => a -> a -> a -> a -> M44 a

Files

CHANGELOG.markdown view
@@ -1,3 +1,7 @@+1.15.1+------+* Added `inversePerspective`. It is much more accurate to compute it directly than to compute an inverse.+ 1.15.0.1 -------- * Fixed build failures caused by `Linear` re-exporting the old name.
linear.cabal view
@@ -1,6 +1,6 @@ name:          linear category:      Math, Algebra-version:       1.15.0.1+version:       1.15.1 license:       BSD3 cabal-version: >= 1.8 license-file:  LICENSE
src/Linear/Projection.hs view
@@ -13,6 +13,7 @@ module Linear.Projection   ( lookAt   , perspective+  , inversePerspective   , infinitePerspective   , ortho   ) where@@ -62,6 +63,25 @@         z = -(far + near) / (far - near)         w = -(2 * far * near) / (far - near) +-- | Build an inverse perspective matrix+inversePerspective+  :: Floating a+  => a -- ^ FOV+  -> a -- ^ Aspect ratio+  -> a -- ^ Near plane+  -> a -- ^ Far plane+  -> M44 a+inversePerspective fovy aspect near far =+  V4 (V4 a 0 0 0   )+     (V4 0 b 0 0   )+     (V4 0 0 0 (-1))+     (V4 0 0 c d   )+  where tanHalfFovy = tan $ fovy / 2+        a = aspect * tanHalfFovy+        b = tanHalfFovy+        c = -(far - near) / (2 * far * near)+        d = (far + near) / (2 * far * near)+  -- | Build a matrix for a symmetric perspective-view frustum with a far plane at infinite infinitePerspective   :: Floating a