AC-Vector 2.1.1 → 2.2.0
raw patch · 8 files changed
+39/−78 lines, 8 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Data.BoundingBox.B1: bounds :: Vector1 -> Vector1 -> BBox1
- Data.BoundingBox.B1: max_bound :: BBox1 -> Vector1
- Data.BoundingBox.B1: min_bound :: BBox1 -> Vector1
- Data.BoundingBox.B1: points_bounds :: [Vector1] -> BBox1
- Data.BoundingBox.B2: bounds :: Vector2 -> Vector2 -> BBox2
- Data.BoundingBox.B2: max_bound :: BBox2 -> Vector2
- Data.BoundingBox.B2: min_bound :: BBox2 -> Vector2
- Data.BoundingBox.B2: points_bounds :: [Vector2] -> BBox2
- Data.BoundingBox.B3: bounds :: Vector3 -> Vector3 -> BBox3
- Data.BoundingBox.B3: max_bound :: BBox3 -> Vector3
- Data.BoundingBox.B3: min_bound :: BBox3 -> Vector3
- Data.BoundingBox.B3: points_bounds :: [Vector3] -> BBox3
- Data.BoundingBox.B4: bounds :: Vector4 -> Vector4 -> BBox4
- Data.BoundingBox.B4: max_bound :: BBox4 -> Vector4
- Data.BoundingBox.B4: min_bound :: BBox4 -> Vector4
- Data.BoundingBox.B4: points_bounds :: [Vector4] -> BBox4
- Data.BoundingBox.Range: bounds :: Scalar -> Scalar -> Range
- Data.BoundingBox.Range: max_bound :: Range -> !!Scalar
- Data.BoundingBox.Range: min_bound :: Range -> !!Scalar
- Data.BoundingBox.Range: points_bounds :: [Scalar] -> Range
- Data.Vector.Transform: data Transform1
- Data.Vector.Transform: data Transform2
- Data.Vector.Transform: data Transform3
- Data.Vector.Transform: data Transform4
- Data.Vector.Transform: transformP1 :: Transform1 -> Vector1 -> Vector1
- Data.Vector.Transform: transformP2 :: Transform2 -> Vector2 -> Vector2
- Data.Vector.Transform: transformP3 :: Transform3 -> Vector3 -> Vector3
- Data.Vector.Transform: transformP4 :: Transform4 -> Vector4 -> Vector4
+ Data.BoundingBox.B1: bound_corners :: Vector1 -> Vector1 -> BBox1
+ Data.BoundingBox.B1: bound_points :: [Vector1] -> BBox1
+ Data.BoundingBox.B1: max_point :: BBox1 -> Vector1
+ Data.BoundingBox.B1: min_point :: BBox1 -> Vector1
+ Data.BoundingBox.B2: bound_corners :: Vector2 -> Vector2 -> BBox2
+ Data.BoundingBox.B2: bound_points :: [Vector2] -> BBox2
+ Data.BoundingBox.B2: max_point :: BBox2 -> Vector2
+ Data.BoundingBox.B2: min_point :: BBox2 -> Vector2
+ Data.BoundingBox.B3: bound_corners :: Vector3 -> Vector3 -> BBox3
+ Data.BoundingBox.B3: bound_points :: [Vector3] -> BBox3
+ Data.BoundingBox.B3: max_point :: BBox3 -> Vector3
+ Data.BoundingBox.B3: min_point :: BBox3 -> Vector3
+ Data.BoundingBox.B4: bound_corners :: Vector4 -> Vector4 -> BBox4
+ Data.BoundingBox.B4: bound_points :: [Vector4] -> BBox4
+ Data.BoundingBox.B4: max_point :: BBox4 -> Vector4
+ Data.BoundingBox.B4: min_point :: BBox4 -> Vector4
+ Data.BoundingBox.Range: bound_corners :: Scalar -> Scalar -> Range
+ Data.BoundingBox.Range: bound_points :: [Scalar] -> Range
+ Data.BoundingBox.Range: max_point :: Range -> !!Scalar
+ Data.BoundingBox.Range: min_point :: Range -> !!Scalar
Files
- AC-Vector.cabal +2/−5
- Data/BoundingBox/B1.hs +8/−8
- Data/BoundingBox/B2.hs +8/−8
- Data/BoundingBox/B3.hs +8/−8
- Data/BoundingBox/B4.hs +8/−8
- Data/BoundingBox/Range.hs +5/−5
- Data/Vector.hs +0/−19
- Data/Vector/Transform.hs +0/−17
AC-Vector.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: >= 1.6 Name: AC-Vector -Version: 2.1.1 +Version: 2.2.0 Stability: Experimental Synopsis: Efficient geometric vectors and transformations. @@ -14,8 +14,7 @@ just contains data structures that are useful for graphics work.) - Now includes @points_bounds@ functions, for finding the bounds - of a list of points. + Removed gather modules. Some name changes for bounding boxes. Category: Data, Math, Numerical, Graphics License: BSD3 @@ -27,13 +26,11 @@ Library Exposed-modules: - Data.Vector, Data.Vector.Class, Data.Vector.V1, Data.Vector.V2, Data.Vector.V3, Data.Vector.V4, - Data.Vector.Transform, Data.Vector.Transform.T1, Data.Vector.Transform.T2, Data.Vector.Transform.T3,
Data/BoundingBox/B1.hs view
@@ -12,24 +12,24 @@ newtype BBox1 = BBox1 {range :: Range} deriving (Eq, Show) -- | Given two vectors, construct a bounding box (swapping the endpoints if necessary). -bounds :: Vector1 -> Vector1 -> BBox1 -bounds (Vector1 xa) (Vector1 xb) = BBox1 $ R.bounds xa xb +bound_corners :: Vector1 -> Vector1 -> BBox1 +bound_corners (Vector1 xa) (Vector1 xb) = BBox1 $ R.bound_corners xa xb -- | Find the bounds of a list of points. (Throws an exception if the list is empty.) -points_bounds :: [Vector1] -> BBox1 -points_bounds = BBox1 . R.points_bounds . map v1x +bound_points :: [Vector1] -> BBox1 +bound_points = BBox1 . R.bound_points . map v1x -- | Test whether a 'Vector1' lies within a 'BBox1'. within_bounds :: Vector1 -> BBox1 -> Bool within_bounds (Vector1 x) (BBox1 r) = x `R.within_bounds` r -- | Return the minimum endpoint for a 'BBox1'. -min_bound :: BBox1 -> Vector1 -min_bound = Vector1 . R.min_bound . range +min_point :: BBox1 -> Vector1 +min_point = Vector1 . R.min_point . range -- | Return the maximum endpoint for a 'BBox1'. -max_bound :: BBox1 -> Vector1 -max_bound = Vector1 . R.max_bound . range +max_point :: BBox1 -> Vector1 +max_point = Vector1 . R.max_point . range -- | Take the union of two 'BBox1' values. The result is a new 'BBox1' that contains all the points the original boxes contained, plus any extra space between them. union :: BBox1 -> BBox1 -> BBox1
Data/BoundingBox/B2.hs view
@@ -24,12 +24,12 @@ rangeXY (Range x0 x1) (Range y0 y1) = BBox2 x0 y0 x1 y1 -- | Given a pair of corner points, construct a bounding box. (The points must be from opposite corners, but it doesn't matter /which/ corners nor which order they are given in.) -bounds :: Vector2 -> Vector2 -> BBox2 -bounds (Vector2 xa ya) (Vector2 xb yb) = BBox2 (min xa xb) (min ya yb) (max xa xb) (max ya yb) +bound_corners :: Vector2 -> Vector2 -> BBox2 +bound_corners (Vector2 xa ya) (Vector2 xb yb) = BBox2 (min xa xb) (min ya yb) (max xa xb) (max ya yb) -- | Find the bounds of a list of points. (Throws an exception if the list is empty.) -points_bounds :: [Vector2] -> BBox2 -points_bounds ps = +bound_points :: [Vector2] -> BBox2 +bound_points ps = let xs = map v2x ps ys = map v2y ps @@ -42,12 +42,12 @@ y `R.within_bounds` (rangeY b) -- | Return the minimum values for both coordinates. (In usual 2D space, the bottom-left corner point.) -min_bound :: BBox2 -> Vector2 -min_bound (BBox2 x0 y0 x1 y1) = Vector2 x0 y0 +min_point :: BBox2 -> Vector2 +min_point (BBox2 x0 y0 x1 y1) = Vector2 x0 y0 -- | Return the maximum values for both coordinates. (In usual 2D space, the top-right corner point.) -max_bound :: BBox2 -> Vector2 -max_bound (BBox2 x0 y0 x1 y1) = Vector2 x1 y1 +max_point :: BBox2 -> Vector2 +max_point (BBox2 x0 y0 x1 y1) = Vector2 x1 y1 -- | Take the union of two bounding boxes. The result is a new bounding box that contains all the points the original boxes contained, plus any extra space between them. union :: BBox2 -> BBox2 -> BBox2
Data/BoundingBox/B3.hs view
@@ -28,12 +28,12 @@ rangeXYZ (Range x0 x1) (Range y0 y1) (Range z0 z1) = BBox3 x0 y0 z0 x1 y1 z1 -- | Given a pair of corner points, construct a bounding box. (The points must be from opposite corners, but it doesn't matter /which/ corners nor which order they are given in.) -bounds :: Vector3 -> Vector3 -> BBox3 -bounds (Vector3 xa ya za) (Vector3 xb yb zb) = BBox3 (min xa xb) (min ya yb) (min za zb) (max xa xb) (max ya yb) (max za zb) +bound_corners :: Vector3 -> Vector3 -> BBox3 +bound_corners (Vector3 xa ya za) (Vector3 xb yb zb) = BBox3 (min xa xb) (min ya yb) (min za zb) (max xa xb) (max ya yb) (max za zb) -- | Find the bounds of a list of points. (Throws an exception if the list is empty.) -points_bounds :: [Vector3] -> BBox3 -points_bounds ps = +bound_points :: [Vector3] -> BBox3 +bound_points ps = let xs = map v3x ps ys = map v3y ps @@ -48,12 +48,12 @@ z `R.within_bounds` (rangeZ b) -- | Return the minimum values for all coordinates. -min_bound :: BBox3 -> Vector3 -min_bound (BBox3 x0 y0 z0 x1 y1 z1) = Vector3 x0 y0 z0 +min_point :: BBox3 -> Vector3 +min_point (BBox3 x0 y0 z0 x1 y1 z1) = Vector3 x0 y0 z0 -- | Return the maximum values for all coordinates. -max_bound :: BBox3 -> Vector3 -max_bound (BBox3 x0 y0 z0 x1 y1 z1) = Vector3 x1 y1 z1 +max_point :: BBox3 -> Vector3 +max_point (BBox3 x0 y0 z0 x1 y1 z1) = Vector3 x1 y1 z1 -- | Take the union of two bounding boxes. The result is a new bounding box that contains all the points the original boxes contained, plus any extra space between them. union :: BBox3 -> BBox3 -> BBox3
Data/BoundingBox/B4.hs view
@@ -32,13 +32,13 @@ rangeXYZW (Range x0 x1) (Range y0 y1) (Range z0 z1) (Range w0 w1) = BBox4 x0 y0 z0 w0 x1 y1 z1 w1 -- | Given a pair of corner points, construct a bounding box. (The points must be from opposite corners, but it doesn't matter /which/ corners nor which order they are given in.) -bounds :: Vector4 -> Vector4 -> BBox4 -bounds (Vector4 xa ya za wa) (Vector4 xb yb zb wb) = +bound_corners :: Vector4 -> Vector4 -> BBox4 +bound_corners (Vector4 xa ya za wa) (Vector4 xb yb zb wb) = BBox4 (min xa xb) (min ya yb) (min za zb) (min wa wb) (max xa xb) (max ya yb) (max za zb) (max wa wb) -- | Find the bounds of a list of points. (Throws an exception if the list is empty.) -points_bounds :: [Vector4] -> BBox4 -points_bounds ps = +bound_points :: [Vector4] -> BBox4 +bound_points ps = let xs = map v4x ps ys = map v4y ps @@ -55,12 +55,12 @@ w `R.within_bounds` (rangeW b) -- | Return the minimum values for all coordinates. -min_bound :: BBox4 -> Vector4 -min_bound (BBox4 x0 y0 z0 w0 x1 y1 z1 w1) = Vector4 x0 y0 z0 w0 +min_point :: BBox4 -> Vector4 +min_point (BBox4 x0 y0 z0 w0 x1 y1 z1 w1) = Vector4 x0 y0 z0 w0 -- | Return the maximum values for all coordinates. -max_bound :: BBox4 -> Vector4 -max_bound (BBox4 x0 y0 z0 w0 x1 y1 z1 w1) = Vector4 x1 y1 z1 w1 +max_point :: BBox4 -> Vector4 +max_point (BBox4 x0 y0 z0 w0 x1 y1 z1 w1) = Vector4 x1 y1 z1 w1 -- | Take the union of two bounding boxes. The result is a new bounding box that contains all the points the original boxes contained, plus any extra space between them. union :: BBox4 -> BBox4 -> BBox4
Data/BoundingBox/Range.hs view
@@ -9,15 +9,15 @@ {- | A 'Range' represents a continuous interval between two 'Scalar' endpoints. -} -data Range = Range {min_bound, max_bound :: {-# UNPACK #-} !Scalar} deriving (Eq, Show) +data Range = Range {min_point, max_point :: {-# UNPACK #-} !Scalar} deriving (Eq, Show) -- | Given two 'Scalar's, construct a 'Range' (swapping the endpoints if necessary so that they are in the correct order. -bounds :: Scalar -> Scalar -> Range -bounds xa xb = Range (min xa xb) (max xa xb) +bound_corners :: Scalar -> Scalar -> Range +bound_corners xa xb = Range (min xa xb) (max xa xb) -- | Find the bounds of a list of points. (Throws an exception if the list is empty.) -points_bounds :: [Scalar] -> Range -points_bounds xs = Range (minimum xs) (maximum xs) +bound_points :: [Scalar] -> Range +bound_points xs = Range (minimum xs) (maximum xs) -- | Test whether a given 'Scalar' falls within a particular 'Range'. within_bounds :: Scalar -> Range -> Bool
− Data/Vector.hs
@@ -1,19 +0,0 @@--- | Convenience module providing easy access to everything in this package. (See individual modules for fuller details.) - -module Data.Vector - ( - module Data.Vector.Class, - module Data.Vector.V1, - module Data.Vector.V2, - module Data.Vector.V3, - module Data.Vector.V4, - module Data.Vector.Transform, - ) - where - -import Data.Vector.Class -import Data.Vector.V1 -import Data.Vector.V2 -import Data.Vector.V3 -import Data.Vector.V4 -import Data.Vector.Transform
− Data/Vector/Transform.hs
@@ -1,17 +0,0 @@-{- | - Convenience module to import all sizes of transform. (This doesn't include all the field names though, just the transform types and their application functions.) --} - -module Data.Vector.Transform - ( - Transform1 (), transformP1, - Transform2 (), transformP2, - Transform3 (), transformP3, - Transform4 (), transformP4, - ) - where - -import Data.Vector.Transform.T1 -import Data.Vector.Transform.T2 -import Data.Vector.Transform.T3 -import Data.Vector.Transform.T4