AC-Vector-Fancy 2.3.0 → 2.4.0
raw patch · 3 files changed
+18/−18 lines, 3 filesdep ~AC-VectorPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: AC-Vector
API changes (from Hackage documentation)
- Data.BoundingBox.Fancy: instance BoundingBox Range
- Data.BoundingBox.Fancy: instance HasSpace Range
+ Data.BoundingBox.Fancy: axis_range :: (BoundingBox bbox, VectorAxis (Point bbox) axis) => axis -> bbox -> Range
+ Data.BoundingBox.Fancy: unions :: BoundingBox b => [b] -> b
- Data.BoundingBox.Fancy: bound_corners :: (BoundingBox b) => Point b -> Point b -> b
+ Data.BoundingBox.Fancy: bound_corners :: BoundingBox b => Point b -> Point b -> b
- Data.BoundingBox.Fancy: bound_points :: (BoundingBox b) => [Point b] -> b
+ Data.BoundingBox.Fancy: bound_points :: BoundingBox b => [Point b] -> b
- Data.BoundingBox.Fancy: class (HasSpace b) => BoundingBox b
+ Data.BoundingBox.Fancy: class HasSpace b => BoundingBox b
- Data.BoundingBox.Fancy: class (HasSpace x) => HasBBox x
+ Data.BoundingBox.Fancy: class HasSpace x => HasBBox x
- Data.BoundingBox.Fancy: isect :: (BoundingBox b) => b -> b -> Maybe b
+ Data.BoundingBox.Fancy: isect :: BoundingBox b => b -> b -> Maybe b
- Data.BoundingBox.Fancy: max_point :: (BoundingBox b) => b -> Point b
+ Data.BoundingBox.Fancy: max_point :: BoundingBox b => b -> Point b
- Data.BoundingBox.Fancy: min_point :: (BoundingBox b) => b -> Point b
+ Data.BoundingBox.Fancy: min_point :: BoundingBox b => b -> Point b
- Data.BoundingBox.Fancy: union :: (BoundingBox b) => b -> b -> b
+ Data.BoundingBox.Fancy: union :: BoundingBox b => b -> b -> b
- Data.BoundingBox.Fancy: within_bounds :: (BoundingBox b) => Point b -> b -> Bool
+ Data.BoundingBox.Fancy: within_bounds :: BoundingBox b => Point b -> b -> Bool
- Data.Vector.Fancy: class HasSpace x where { type family Point x :: *; }
+ Data.Vector.Fancy: class Vector (Point x) => HasSpace x where { type family Point x :: *; }
- Data.Vector.Fancy: get_coord :: (VectorAxis vector axis) => axis -> vector -> Scalar
+ Data.Vector.Fancy: get_coord :: VectorAxis vector axis => axis -> vector -> Scalar
- Data.Vector.Fancy: orthographic_down :: (Project v) => ProjectTo v -> (v, Scalar)
+ Data.Vector.Fancy: orthographic_down :: Project v => ProjectTo v -> (v, Scalar)
- Data.Vector.Fancy: orthographic_up :: (Project v) => (v, Scalar) -> ProjectTo v
+ Data.Vector.Fancy: orthographic_up :: Project v => (v, Scalar) -> ProjectTo v
- Data.Vector.Fancy: perspective_down :: (Project v) => ProjectTo v -> (v, Scalar)
+ Data.Vector.Fancy: perspective_down :: Project v => ProjectTo v -> (v, Scalar)
- Data.Vector.Fancy: perspective_up :: (Project v) => (v, Scalar) -> ProjectTo v
+ Data.Vector.Fancy: perspective_up :: Project v => (v, Scalar) -> ProjectTo v
- Data.Vector.Fancy: set_coord :: (VectorAxis vector axis) => axis -> Scalar -> vector -> vector
+ Data.Vector.Fancy: set_coord :: VectorAxis vector axis => axis -> Scalar -> vector -> vector
- Data.Vector.Transform.Fancy: class (Transform t) => Rotate t axis1 axis2
+ Data.Vector.Transform.Fancy: class Transform t => Rotate t axis1 axis2
- Data.Vector.Transform.Fancy: class (HasSpace t) => Transform t
+ Data.Vector.Transform.Fancy: class HasSpace t => Transform t
- Data.Vector.Transform.Fancy: class (HasSpace x) => Transformable x
+ Data.Vector.Transform.Fancy: class HasSpace x => Transformable x
- Data.Vector.Transform.Fancy: scaleT :: (Transform t) => Point t -> t
+ Data.Vector.Transform.Fancy: scaleT :: Transform t => Point t -> t
- Data.Vector.Transform.Fancy: scaleT_ :: (Transform t) => Scalar -> t
+ Data.Vector.Transform.Fancy: scaleT_ :: Transform t => Scalar -> t
- Data.Vector.Transform.Fancy: transformP :: (Transform t) => t -> Point t -> Point t
+ Data.Vector.Transform.Fancy: transformP :: Transform t => t -> Point t -> Point t
- Data.Vector.Transform.Fancy: translateT :: (Transform t) => Point t -> t
+ Data.Vector.Transform.Fancy: translateT :: Transform t => Point t -> t
Files
- AC-Vector-Fancy.cabal +6/−5
- Data/BoundingBox/Fancy.hs +11/−12
- Data/Vector/Fancy.hs +1/−1
AC-Vector-Fancy.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: >= 1.6 Name: AC-Vector-Fancy -Version: 2.3.0 +Version: 2.4.0 Stability: Experimental Synopsis: Fancy type-system stuff for AC-Vector @@ -10,9 +10,10 @@ (Requires several language extensions, including type families.) - Changed the @Project@ class from being multi-parameter - to using an associated type. (Should help resolve some - of the \"ambiguous type\" errors.) + Added missing @Vector Point@ constraint to @HasSpace@ + class. Consequently removed @HasSpace Range@ instance. + Added @unions@ method to @BoundingBox@ class. Added + @axis_range@ function. Category: Data, Math, Numerical, Graphics License: BSD3 @@ -30,5 +31,5 @@ Data.Vector.Transform.Fancy, Data.BoundingBox, Data.BoundingBox.Fancy - Build-Depends: base >= 4 && < 5, AC-Angle >= 1.0, AC-Vector >= 2.3.0 + Build-Depends: base >= 4 && < 5, AC-Angle >= 1.0, AC-Vector >= 2.3.1 HS-Source-Dirs: .
Data/BoundingBox/Fancy.hs view
@@ -2,7 +2,7 @@ Classes for generically handling bounding boxes, and things that possess bounding boxes. -} -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, TypeFamilies #-} module Data.BoundingBox.Fancy where @@ -36,17 +36,8 @@ -- | Take the intersection of two bounding boxes. If the boxes do not overlap, return 'Nothing'. Otherwise return a bounding box containing only the points common to both original bounding boxes. isect :: b -> b -> Maybe b -instance HasSpace R.Range where - type Point R.Range = Scalar - -instance BoundingBox R.Range where - bound_corners = R.bound_corners - bound_points = R.bound_points - min_point = R.min_point - max_point = R.max_point - within_bounds = R.within_bounds - union = R.union - isect = R.isect + -- | Take the union of a list of bounding boxes. (This is more efficient than @foldr1 union@.) + unions :: [b] -> b instance HasSpace B1.BBox1 where type Point B1.BBox1 = Vector1 @@ -59,6 +50,7 @@ within_bounds = B1.within_bounds union = B1.union isect = B1.isect + unions = B1.unions instance HasSpace B2.BBox2 where type Point B2.BBox2 = Vector2 @@ -71,6 +63,7 @@ within_bounds = B2.within_bounds union = B2.union isect = B2.isect + unions = B2.unions instance HasSpace B3.BBox3 where type Point B3.BBox3 = Vector3 @@ -83,6 +76,7 @@ within_bounds = B3.within_bounds union = B3.union isect = B3.isect + unions = B3.unions instance HasSpace B4.BBox4 where type Point B4.BBox4 = Vector4 @@ -95,6 +89,11 @@ within_bounds = B4.within_bounds union = B4.union isect = B4.isect + unions = B4.unions + +-- | Get a 'R.Range' representing the extent of a bounding box on a specified coordinate axis. +axis_range :: (BoundingBox bbox, VectorAxis (Point bbox) axis) => axis -> bbox -> R.Range +axis_range axis bbox = R.Range (get_coord axis (min_point bbox)) (get_coord axis (max_point bbox))
Data/Vector/Fancy.hs view
@@ -21,7 +21,7 @@ Null instances are provided for all the vector types. (E.g., @Point Vector3 = Vector3@.) -} -class HasSpace x where +class (Vector (Point x)) => HasSpace x where -- | Give the appropriate kind of vector for this type. type Point x :: *