packages feed

Octree 0.3 → 0.4

raw patch · 4 files changed

+21/−6 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Octree: size :: Octree a -> Int

Files

Data/Octree.hs view
@@ -6,6 +6,7 @@                    insert,                    nearest,                    depth,+                   size,                    withinRange) where 
Data/Octree/Internal.hs view
@@ -6,7 +6,7 @@                             octreeStep, octantDistance, splitBy', joinStep, splitStep, allOctants, octantDistance',                             cmp,                             pickClosest,-                            depth+                            depth, size                             ) where  import Data.Vector.V3@@ -57,10 +57,6 @@ -- | Enumerated type to indicate octants in 3D-space relative to given center. data ODir = SWD | SED | NWD | NED | SWU | SEU | NWU | NEU deriving (Eq, Ord, Enum, Show, Bounded) -depth :: Octree a -> Int-depth (Leaf l) = 0-depth (Node _ a b c d e f g h) = Prelude.maximum . map (\n -> depth n + 1) $ [a, b, c, d, e, f, g, h]- -- | Internal method that gives octant of a first vector relative to the second vector as a center. cmp :: Vector3 -> Vector3 -> ODir cmp ca cb = joinStep (cx, cy, cz)@@ -297,4 +293,14 @@                             octantDistances $ pt - split node   -- find octant distances   where     recurseOctant (octant, _d) = withinRange r pt . octreeStep node $ octant++subnodes (Leaf _) = []+subnodes node     = map (octreeStep node) allOctants++depth :: Octree a -> Int+depth (Leaf _) = 0+depth node     = foldr max 0 . map (+1) . map depth . subnodes $ node++size :: Octree a -> Int+size =  length . toList 
Octree.cabal view
@@ -1,5 +1,5 @@ name:                Octree-version:             0.3+version:             0.4 stability:           beta homepage:            https://github.com/mgajda/octree package-url:         http://hackage.haskell.org/package/octree
tests/test_Octree.hs view
@@ -103,4 +103,12 @@  genericProperty_fmap f l = (sort . map (Control.Arrow.second f) $ l) == (sort . toList . fmap f . fromList $ l) +prop_depth_empty = depth (Leaf []) == 0++prop_depth_upper_bound l = depth ot <= max 0 (ceiling . logBase 2 . realToFrac $ size) -- worst splitting ratio possible when we take midpoint (and inputs are colinear)+  where ot   = fromList l+        size = length l++prop_size l = size (fromList l) == length l+ main = $quickCheckAll