linear 1.13 → 1.14
raw patch · 4 files changed
+46/−22 lines, 4 files
Files
- CHANGELOG.markdown +4/−0
- linear.cabal +2/−1
- src/Linear/Plucker.hs +2/−21
- src/Linear/Plucker/Coincides.hs +38/−0
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+1.14+----+* Moved `Coincides` to `Linear.Plucker.Coincides`. The constructors `Line` and `Ray` oft collided with user code.+ 1.13 ---- * Switched 'ortho' to follow the OpenGL handedness.
linear.cabal view
@@ -1,6 +1,6 @@ name: linear category: Math, Algebra-version: 1.13+version: 1.14 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -61,6 +61,7 @@ Linear.Metric Linear.Perspective Linear.Plucker+ Linear.Plucker.Coincides Linear.Quaternion Linear.Trace Linear.V
src/Linear/Plucker.hs view
@@ -34,7 +34,8 @@ , quadranceToOrigin , closestToOrigin , isLine- , Coincides(..)+ , coincides+ , coincides' -- * Basis elements , p01, p02, p03 , p10, p12, p13@@ -442,26 +443,6 @@ saveDiv x y | nearZero y = Option Nothing | otherwise = Option . Just $ First (x / y) {-# INLINABLE coincides' #-}---- | When lines are represented as Plücker coordinates, we have the--- ability to check for both directed and undirected--- equality. Undirected equality between 'Line's (or a 'Line' and a--- 'Ray') checks that the two lines coincide in 3D space. Directed--- equality, between two 'Ray's, checks that two lines coincide in 3D,--- and have the same direction. To accomodate these two notions of--- equality, we use an 'Eq' instance on the 'Coincides' data type.------ For example, to check the /directed/ equality between two lines,--- @p1@ and @p2@, we write, @Ray p1 == Ray p2@.-data Coincides a where- Line :: (Epsilon a, Fractional a) => Plucker a -> Coincides a- Ray :: (Epsilon a, Fractional a, Ord a) => Plucker a -> Coincides a--instance Eq (Coincides a) where- Line a == Line b = coincides a b- Line a == Ray b = coincides a b- Ray a == Line b = coincides a b- Ray a == Ray b = coincides' a b -- | The minimum squared distance of a line from the origin. quadranceToOrigin :: Fractional a => Plucker a -> a
+ src/Linear/Plucker/Coincides.hs view
@@ -0,0 +1,38 @@+{-# LANGUAGE GADTs #-}+---------------------------------------------------------------------------------+-- |+-- Copyright : (C) 2012-2014 Edward Kmett,+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Edward Kmett <ekmett@gmail.com>+-- Stability : experimental+-- Portability : non-portable+--+-- Utility for working with Plücker coordinates for lines in 3d homogeneous space.+----------------------------------------------------------------------------------+module Linear.Plucker.Coincides+ ( Coincides(..)+ ) where++import Linear.Epsilon+import Linear.Plucker++-- | When lines are represented as Plücker coordinates, we have the+-- ability to check for both directed and undirected+-- equality. Undirected equality between 'Line's (or a 'Line' and a+-- 'Ray') checks that the two lines coincide in 3D space. Directed+-- equality, between two 'Ray's, checks that two lines coincide in 3D,+-- and have the same direction. To accomodate these two notions of+-- equality, we use an 'Eq' instance on the 'Coincides' data type.+--+-- For example, to check the /directed/ equality between two lines,+-- @p1@ and @p2@, we write, @Ray p1 == Ray p2@.+data Coincides a where+ Line :: (Epsilon a, Fractional a) => Plucker a -> Coincides a+ Ray :: (Epsilon a, Fractional a, Ord a) => Plucker a -> Coincides a++instance Eq (Coincides a) where+ Line a == Line b = coincides a b+ Line a == Ray b = coincides a b+ Ray a == Line b = coincides a b+ Ray a == Ray b = coincides' a b