simple-vec3 0.4.0.10 → 0.6.0.1
raw patch · 6 files changed
Files
- CHANGELOG.md +26/−1
- README.md +1/−1
- simple-vec3.cabal +73/−63
- src/Data/Vec3.hs +3/−5
- src/Data/Vec3/Class.hs +5/−1
- tests/Main.hs +2/−2
CHANGELOG.md view
@@ -1,11 +1,33 @@ # Changelog -## [0.4.0.10] - 2018-01-18+## [0.6.0.1] - 2020-06-04 ### Changed +- Relaxed dependency version bounds++## [0.6] - 2019-06-12++### Changed++- simple-vec3 operators now bind tighter than `*` for `Num`, so you+ can write `2 * v .* d`.++## [0.5] - 2019-06-11++### Changed++- Operator precedence order is now as follows: `.^`, `.*`, `<+>`,+ `<->`, `><` (multiplication binds most tightly).+ - Test suite dependencies bump +## [0.4.0.10] - 2019-01-18++### Changed++- Test suite dependencies bump+ ## [0.4.0.9] - 2018-10-29 ### Changed@@ -118,6 +140,9 @@ ## [0.1.0.0] - 2012-12-05 +[0.6.0.1]: https://github.com/dzhus/simple-vec3/compare/0.6...0.6.0.1+[0.6]: https://github.com/dzhus/simple-vec3/compare/0.5...0.6+[0.5]: https://github.com/dzhus/simple-vec3/compare/0.4.0.10...0.5 [0.4.0.10]:https://github.com/dzhus/simple-vec3/compare/0.4.0.9...0.4.0.10 [0.4.0.9]: https://github.com/dzhus/simple-vec3/compare/0.4.0.8...0.4.0.9 [0.4.0.8]: https://github.com/dzhus/simple-vec3/compare/0.4.0.7...0.4.0.8
README.md view
@@ -1,6 +1,6 @@ # simple-vec3 -[](https://travis-ci.org/dzhus/simple-vec3)+[](https://github.com/dzhus/simple-vec3/actions) [](https://hackage.haskell.org/package/simple-vec3) [](http://packdeps.haskellers.com/feed?needle=simple-vec3)
simple-vec3.cabal view
@@ -1,77 +1,87 @@ cabal-version: 1.12-name: simple-vec3-version: 0.4.0.10-license: BSD3-license-file: LICENSE-maintainer: dima@dzhus.org-author: Dmitry Dzhus-homepage: https://github.com/dzhus/simple-vec3#readme-bug-reports: https://github.com/dzhus/simple-vec3/issues-synopsis: Three-dimensional vectors of doubles with basic operations-description:- Simple three-dimensional vectors of doubles with basic vector and matrix operations, supporting "Data.Vector.Unboxed" and "Data.Vector.Storable".-category: Math, Numerical-build-type: Simple++-- This file has been generated from package.yaml by hpack version 0.33.0.+--+-- see: https://github.com/sol/hpack+--+-- hash: 865417e7bfa5a725189d06e9964f2248482bbe028d11486b38f34905749f42f5++name: simple-vec3+version: 0.6.0.1+synopsis: Three-dimensional vectors of doubles with basic operations+description: Simple three-dimensional vectors of doubles with basic vector and matrix operations, supporting "Data.Vector.Unboxed" and "Data.Vector.Storable".+category: Math, Numerical+homepage: https://github.com/dzhus/simple-vec3#readme+bug-reports: https://github.com/dzhus/simple-vec3/issues+author: Dmitry Dzhus+maintainer: dima@dzhus.org+license: BSD3+license-file: LICENSE+build-type: Simple extra-source-files: CHANGELOG.md README.md source-repository head- type: git- location: https://github.com/dzhus/simple-vec3+ type: git+ location: https://github.com/dzhus/simple-vec3 library- exposed-modules:- Data.Vec3- Data.Vec3.Class- hs-source-dirs: src- other-modules:- Paths_simple_vec3- default-language: Haskell2010- ghc-options: -Wall -Wcompat -O2- build-depends:- QuickCheck <2.13,- base <5,- vector <0.13+ exposed-modules:+ Data.Vec3+ Data.Vec3.Class+ other-modules:+ Paths_simple_vec3+ hs-source-dirs:+ src+ ghc-options: -Wall -Wcompat -O2+ build-depends:+ QuickCheck+ , base <5+ , vector+ default-language: Haskell2010 test-suite simple-vec3-doctests- type: exitcode-stdio-1.0- main-is: doctest-driver.hs- hs-source-dirs: tests- other-modules:- Main- Paths_simple_vec3- default-language: Haskell2010- ghc-options: -Wall -Wcompat -O2 -threaded- build-depends:- base <5,- doctest <0.17,- doctest-driver-gen <0.4+ type: exitcode-stdio-1.0+ main-is: doctest-driver.hs+ other-modules:+ Main+ Paths_simple_vec3+ hs-source-dirs:+ tests+ ghc-options: -Wall -Wcompat -O2 -threaded+ build-depends:+ base <5+ , doctest+ , doctest-driver-gen+ default-language: Haskell2010 test-suite simple-vec3-test- type: exitcode-stdio-1.0- main-is: Main.hs- hs-source-dirs: tests- other-modules:- Paths_simple_vec3- default-language: Haskell2010- ghc-options: -Wall -Wcompat -O2- build-depends:- base <5,- simple-vec3 -any,- tasty <1.3,- tasty-quickcheck <0.11+ type: exitcode-stdio-1.0+ main-is: Main.hs+ other-modules:+ Paths_simple_vec3+ hs-source-dirs:+ tests+ ghc-options: -Wall -Wcompat -O2+ build-depends:+ base <5+ , simple-vec3+ , tasty+ , tasty-quickcheck+ default-language: Haskell2010 benchmark simple-vec3-benchmark- type: exitcode-stdio-1.0- main-is: Benchmark.hs- hs-source-dirs: benchmark- other-modules:- Paths_simple_vec3- default-language: Haskell2010- ghc-options: -Wall -Wcompat -O2- build-depends:- base <5,- criterion <1.6,- simple-vec3 -any,- vector <0.13+ type: exitcode-stdio-1.0+ main-is: Benchmark.hs+ other-modules:+ Paths_simple_vec3+ hs-source-dirs:+ benchmark+ ghc-options: -Wall -Wcompat -O2+ build-depends:+ base <5+ , criterion+ , simple-vec3+ , vector+ default-language: Haskell2010
src/Data/Vec3.hs view
@@ -25,8 +25,6 @@ where -import Control.Monad- import Foreign import Foreign.C.Types @@ -129,7 +127,7 @@ {-# INLINE basicOverlaps #-} basicUnsafeNew n =- MV_CVec3 `liftM` VGM.basicUnsafeNew (n * 3)+ MV_CVec3 <$> VGM.basicUnsafeNew (n * 3) {-# INLINE basicUnsafeNew #-} basicUnsafeRead (MV_CVec3 v) i = do@@ -152,11 +150,11 @@ instance VG.Vector VU.Vector CVec3 where basicUnsafeFreeze (MV_CVec3 v) =- V_CVec3 `liftM` VG.basicUnsafeFreeze v+ V_CVec3 <$> VG.basicUnsafeFreeze v {-# INLINE basicUnsafeFreeze #-} basicUnsafeThaw (V_CVec3 v) =- MV_CVec3 `liftM` VG.basicUnsafeThaw v+ MV_CVec3 <$> VG.basicUnsafeThaw v {-# INLINE basicUnsafeThaw #-} basicLength (V_CVec3 v) = VG.basicLength v `quot` 3
src/Data/Vec3/Class.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE TypeSynonymInstances #-} module Data.Vec3.Class ( Vec3(..)@@ -42,11 +41,13 @@ (<+>) :: v -> v -> v (<+>) = zipWith (+) {-# INLINE (<+>) #-}+ infixl 7 <+> -- | Subtract two vectors. (<->) :: v -> v -> v (<->) = zipWith (-) {-# INLINE (<->) #-}+ infixl 7 <-> -- | Cross product. (><) :: v -> v -> v@@ -56,18 +57,21 @@ where (x1, y1, z1) = toXYZ v1 (x2, y2, z2) = toXYZ v2+ infixl 8 >< -- | Scale a vector. (.^) :: v -> Double -> v (.^) v s = fromXYZ (x * s, y * s, z * s) where (x, y, z) = toXYZ v+ infixl 9 .^ -- | Dot product. (.*) :: v -> v -> Double (.*) v1 v2 = x + y + z where (x, y, z) = toXYZ $ zipWith (*) v1 v2+ infixl 8 .* -- | Euclidean norm of a vector. norm :: v -> Double
tests/Main.hs view
@@ -58,10 +58,10 @@ (\(v :: ty) -> v .^ 1 <~=> v) , testProperty "Distributivity wrt vector addition"- (\(a :: ty) b p -> ((a <+> b) .^ p) <~=> (a .^ p) <+> (b .^ p))+ (\(a :: ty) b p -> ((a <+> b) .^ p) <~=> a .^ p <+> b .^ p) , testProperty "Distributivity wrt scalar addition"- (\(a :: ty) p q -> a .^ (p + q) <~=> (a .^ p) <+> (a .^ q))+ (\(a :: ty) p q -> a .^ (p + q) <~=> a .^ p <+> a .^ q) , testProperty "Subtraction definition" (\(a :: ty) b -> a <+> invert b <~=> a <-> b)