mischief-math 0.1.0.0 → 0.1.1.0
raw patch · 5 files changed
+40/−5 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Mischief.Math.Vec.Orphans.FieldAccessors: instance GHC.Internal.Records.HasField "w" (Linear.V4.V4 a) a
+ Mischief.Math.Vec.Orphans.FieldAccessors: instance GHC.Internal.Records.HasField "x" (Linear.V4.V4 a) a
+ Mischief.Math.Vec.Orphans.FieldAccessors: instance GHC.Internal.Records.HasField "y" (Linear.V4.V4 a) a
+ Mischief.Math.Vec.Orphans.FieldAccessors: instance GHC.Internal.Records.HasField "z" (Linear.V4.V4 a) a
Files
- CHANGELOG.md +5/−0
- README.md +9/−0
- mischief-math.cabal +4/−2
- src/Mischief/Math/Quat.hs +6/−3
- src/Mischief/Math/Vec/Orphans/FieldAccessors.hs +16/−0
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for mischief-math +## 0.1.1.0 ++* Added Field Accessors for V4. +* Fixed a minor quaternion rotation bug. + ## 0.1.0.0 * First version. Released on an unsuspecting world.
+ README.md view
@@ -0,0 +1,9 @@+# mischief-math++Library re-exporting variosu types, functions, and operators from [linear](https://hackage.haskell.org/package/linear). It also adds +a Transform component. You can read more about it at the root module, `Mischief.Math`, above. ++This library lives in the official [repo](https://codeberg.org/mischief/mischief) and is considered a "core library" of the ecosystem. ++To contribute, you can file issues, such as bug reports and feature requests, in the official [repository](https://codeberg.org/mischief/mischief).+You can also join the official server on discord to be kept up to date with updates and chat with the rest of the community. Link in the aforementioned repo.
mischief-math.cabal view
@@ -18,7 +18,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.0.0+version: 0.1.1.0 -- A short (one-line) description of the package. -- synopsis: -- A longer description of the package.@@ -37,7 +37,9 @@ -- copyright: build-type: Simple -- Extra doc files to be distributed with the package, such as a CHANGELOG or a README.-extra-doc-files: CHANGELOG.md+extra-doc-files:+ CHANGELOG.md+ README.md -- Extra source files to be distributed with the package, such as examples, or a tutorial module. -- extra-source-files:
src/Mischief/Math/Quat.hs view
@@ -21,17 +21,20 @@ fromRotationX :: Float -> Quat fromRotationX angle =- let (s, c) = (sin angle, cos angle)+ let angle' = angle / 2+ (s, c) = (sin angle', cos angle') in fromXYZW (s, 0, 0, c) fromRotationY :: Float -> Quat fromRotationY angle =- let (s, c) = (sin angle, cos angle)+ let angle' = angle / 2+ (s, c) = (sin angle', cos angle') in fromXYZW (0, s, 0, c) fromRotationZ :: Float -> Quat fromRotationZ angle =- let (s, c) = (sin angle, cos angle)+ let angle' = angle / 2+ (s, c) = (sin angle', cos angle') in fromXYZW (0, 0, s, c) fromAngles :: V3 Float -> Quat
src/Mischief/Math/Vec/Orphans/FieldAccessors.hs view
@@ -24,3 +24,19 @@ instance HasField "z" (V3 a) a where getField :: V3 a -> a getField (V3 _ _ z) = z++instance HasField "x" (V4 a) a where+ getField :: V4 a -> a+ getField (V4 x _ _ _) = x++instance HasField "y" (V4 a) a where+ getField :: V4 a -> a+ getField (V4 _ y _ _) = y++instance HasField "z" (V4 a) a where+ getField :: V4 a -> a+ getField (V4 _ _ z _) = z++instance HasField "w" (V4 a) a where+ getField :: V4 a -> a+ getField (V4 _ _ z _) = z