Skip to content

Commit

Permalink
imports
Browse files Browse the repository at this point in the history
  • Loading branch information
stla committed Nov 15, 2023
1 parent 7576e84 commit 660ab92
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 32 deletions.
24 changes: 15 additions & 9 deletions src/Geometry/Delaunay/CDelaunay.hs
Expand Up @@ -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
Expand Down
34 changes: 21 additions & 13 deletions src/Geometry/Delaunay/Delaunay.hs
Expand Up @@ -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
Expand Down
17 changes: 13 additions & 4 deletions src/Geometry/Delaunay/Types.hs
Expand Up @@ -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]
Expand Down
8 changes: 6 additions & 2 deletions src/Geometry/Qhull/Shared.hs
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Geometry/Qhull/Types.hs
Expand Up @@ -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
Expand Down

0 comments on commit 660ab92

Please sign in to comment.