module Data.BoundingBox.Fancy where
import Data.Vector
import qualified Data.BoundingBox.Range as R
import qualified Data.BoundingBox.B1 as B1
import qualified Data.BoundingBox.B2 as B2
import qualified Data.BoundingBox.B3 as B3
import qualified Data.BoundingBox.B4 as B4
class HasSpace b => BoundingBox b where
bound_corners :: Point b -> Point b -> b
bound_points :: [Point b] -> b
min_point :: b -> Point b
max_point :: b -> Point b
within_bounds :: Point b -> b -> Bool
union :: b -> b -> b
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
instance HasSpace B1.BBox1 where
type Point B1.BBox1 = Vector1
instance BoundingBox B1.BBox1 where
bound_corners = B1.bound_corners
bound_points = B1.bound_points
min_point = B1.min_point
max_point = B1.max_point
within_bounds = B1.within_bounds
union = B1.union
isect = B1.isect
instance HasSpace B2.BBox2 where
type Point B2.BBox2 = Vector2
instance BoundingBox B2.BBox2 where
bound_corners = B2.bound_corners
bound_points = B2.bound_points
min_point = B2.min_point
max_point = B2.max_point
within_bounds = B2.within_bounds
union = B2.union
isect = B2.isect
instance HasSpace B3.BBox3 where
type Point B3.BBox3 = Vector3
instance BoundingBox B3.BBox3 where
bound_corners = B3.bound_corners
bound_points = B3.bound_points
min_point = B3.min_point
max_point = B3.max_point
within_bounds = B3.within_bounds
union = B3.union
isect = B3.isect
instance HasSpace B4.BBox4 where
type Point B4.BBox4 = Vector4
instance BoundingBox B4.BBox4 where
bound_corners = B4.bound_corners
bound_points = B4.bound_points
min_point = B4.min_point
max_point = B4.max_point
within_bounds = B4.within_bounds
union = B4.union
isect = B4.isect
class HasSpace x => HasBBox x where
get_bbox :: (BoundingBox b, Point b ~ Point x) => x -> b