diff --git a/src/Geometry/Delaunay/CDelaunay.hs b/src/Geometry/Delaunay/CDelaunay.hs index 7208241..24b7244 100644 --- a/src/Geometry/Delaunay/CDelaunay.hs +++ b/src/Geometry/Delaunay/CDelaunay.hs @@ -6,17 +6,23 @@ module Geometry.Delaunay.CDelaunay , c_tessellation ) where -import Control.Monad ((<$!>)) +import Control.Monad ( (<$!>) ) import qualified Data.HashMap.Strict.InsOrd as H -import Data.IntMap.Strict (fromAscList, (!)) +import Data.IntMap.Strict ( fromAscList, (!) ) import qualified Data.IntSet as IS -import Data.List -import Data.Maybe -import Data.Tuple.Extra (both, fst3, snd3, thd3, (&&&)) -import Geometry.Delaunay.Types -import Foreign -import Foreign.C.Types -import Geometry.Qhull.Types +import Data.List ( findIndex ) +import Data.Maybe ( fromJust, isJust ) +import Data.Tuple.Extra ( both, fst3, snd3, thd3, (&&&) ) +import Geometry.Delaunay.Types ( Tessellation(..), + Tile(..), + TileFacet(..), + Simplex(..), + Site(..) ) +import Foreign ( Ptr, + Storable(pokeByteOff, poke, peek, alignment, sizeOf, peekByteOff), + peekArray ) +import Foreign.C.Types ( CInt, CDouble(..), CUInt(..) ) +import Geometry.Qhull.Types ( Family(Family, None), IndexPair(Pair) ) data CSite = CSite { __id :: CUInt diff --git a/src/Geometry/Delaunay/Delaunay.hs b/src/Geometry/Delaunay/Delaunay.hs index aa846fa..5de8863 100644 --- a/src/Geometry/Delaunay/Delaunay.hs +++ b/src/Geometry/Delaunay/Delaunay.hs @@ -10,19 +10,27 @@ module Geometry.Delaunay.Delaunay , facetCenters' ) where -import Control.Monad (unless, when) -import Data.IntMap.Strict (IntMap) -import qualified Data.IntMap.Strict as IM -import qualified Data.IntSet as IS -import Data.List.Unique (allUnique) -import Data.Maybe -import Geometry.Delaunay.CDelaunay -import Geometry.Delaunay.Types -import Foreign.C.Types -import Foreign.Marshal.Alloc (free, mallocBytes) -import Foreign.Marshal.Array (pokeArray) -import Foreign.Storable (peek, sizeOf) -import Geometry.Qhull.Types +import Control.Monad ( unless, when ) +import Data.IntMap.Strict ( IntMap ) +import qualified Data.IntMap.Strict as IM +import qualified Data.IntSet as IS +import Data.List.Unique ( allUnique ) +import Data.Maybe ( fromMaybe ) +import Geometry.Delaunay.CDelaunay ( c_tessellation + , cTessellationToTessellation + ) +import Geometry.Delaunay.Types ( Tessellation(_tilefacets, _sites, _tiles), + Tile, + TileFacet(_facetOf), + Site(_neighfacetsIds) ) +import Foreign.C.Types ( CDouble, CUInt ) +import Foreign.Marshal.Alloc ( free, mallocBytes ) +import Foreign.Marshal.Array ( pokeArray ) +import Foreign.Storable ( peek, sizeOf ) +import Geometry.Qhull.Types ( HasCenter(_center), + HasFamily(_family), + Family, + Index ) delaunay :: [[Double]] -- ^ sites (vertex coordinates) -> Bool -- ^ whether to add a point at infinity diff --git a/src/Geometry/Delaunay/Types.hs b/src/Geometry/Delaunay/Types.hs index 57b39b9..f40c77b 100644 --- a/src/Geometry/Delaunay/Types.hs +++ b/src/Geometry/Delaunay/Types.hs @@ -7,10 +7,19 @@ module Geometry.Delaunay.Types , Tessellation (..) ) where -import Data.IntMap.Strict (IntMap) -import qualified Data.IntMap.Strict as IM -import Data.IntSet (IntSet) -import Geometry.Qhull.Types +import Data.IntMap.Strict ( IntMap ) +import qualified Data.IntMap.Strict as IM +import Data.IntSet ( IntSet ) +import Geometry.Qhull.Types ( HasCenter(..), + HasVolume(..), + HasEdges(..), + HasVertices(..), + HasNormal(..), + HasFamily(..), + Family, + EdgeMap, + IndexSet, + IndexMap ) data Site = Site { _point :: [Double] diff --git a/src/Geometry/Qhull/Shared.hs b/src/Geometry/Qhull/Shared.hs index 2258f21..1fb8d0c 100644 --- a/src/Geometry/Qhull/Shared.hs +++ b/src/Geometry/Qhull/Shared.hs @@ -15,8 +15,12 @@ module Geometry.Qhull.Shared where import qualified Data.HashMap.Strict.InsOrd as H import qualified Data.IntMap.Strict as IM -import Data.Maybe -import Geometry.Qhull.Types +import Data.Maybe ( fromJust ) +import Geometry.Qhull.Types ( HasEdges(..), + HasVertices(..), + Family(Family), + IndexPair(..), + Index ) -- | whether two families are the same sameFamily :: Family -> Family -> Bool diff --git a/src/Geometry/Qhull/Types.hs b/src/Geometry/Qhull/Types.hs index 87ba63c..5d1d5fb 100644 --- a/src/Geometry/Qhull/Types.hs +++ b/src/Geometry/Qhull/Types.hs @@ -14,10 +14,10 @@ module Geometry.Qhull.Types , HasVolume (..) ) where -import Data.Hashable -import Data.HashMap.Strict.InsOrd (InsOrdHashMap) -import Data.IntMap.Strict (IntMap) -import Data.IntSet (IntSet) +import Data.Hashable ( Hashable(hashWithSalt) ) +import Data.HashMap.Strict.InsOrd ( InsOrdHashMap ) +import Data.IntMap.Strict ( IntMap ) +import Data.IntSet ( IntSet ) type Index = Int type IndexMap = IntMap