Add generic derivations and To/FromJSON instances
This commit is contained in:
@@ -1,13 +1,25 @@
|
||||
{-# LANGUAGE StandaloneDeriving #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
{- |
|
||||
WARNING: orphan instances concerning Aeson classes and Linear.Quaternion datatypes have been introduced.
|
||||
The warnings have been disabled.
|
||||
-}
|
||||
module Quaternion
|
||||
( rotateToZ
|
||||
, vToQuat
|
||||
, module Linear.Quaternion
|
||||
) where
|
||||
import Data.Aeson
|
||||
import Geometry.Data
|
||||
import Geometry.Vector3D
|
||||
import qualified Linear.Quaternion as Q
|
||||
import Linear.Quaternion
|
||||
|
||||
instance ToJSON a => ToJSON (Q.Quaternion a) where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON a => FromJSON (Q.Quaternion a)
|
||||
|
||||
-- apply a rotation as if the z axis moves to the new point.
|
||||
-- i think this may instead do as if the new point moves to be on z axis
|
||||
rotateToZ :: Point3 -> Point3 -> Point3
|
||||
|
||||
Reference in New Issue
Block a user