hgeometry-combinatorial-0.12.0.3: Data structures, and Data types.
Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageHaskell2010

Data.Intersection

Description

Defines a data type for representing intersections. Mostly useful for the more geometric types.

Synopsis

Documentation

type Intersection g h = CoRec Identity (IntersectionOf g h) Source #

The result of interesecting two geometries is a CoRec,

type family IntersectionOf g h :: [*] Source #

The type family specifying the list of possible result types of an intersection.

Instances

Instances details
type IntersectionOf (Range a) (Range a) Source # 
Instance details

Defined in Data.Range

coRec :: a as => a -> CoRec Identity as Source #

Helper to produce a corec

class IsIntersectableWith g h where Source #

Class relationship between intersectable geometric objects.

Minimal complete definition

intersect, nonEmptyIntersection

Methods

intersect :: g -> h -> Intersection g h Source #

intersects :: g -> h -> Bool Source #

g intersects h = The intersection of g and h is non-empty.

The default implementation computes the intersection of g and h, and uses nonEmptyIntersection to determine if the intersection is non-empty.

nonEmptyIntersection :: proxy g -> proxy h -> Intersection g h -> Bool Source #

Helper to implement intersects.

Instances

Instances details
Ord a => IsIntersectableWith (Range a) (Range a) Source # 
Instance details

Defined in Data.Range

Methods

intersect :: Range a -> Range a -> Intersection (Range a) (Range a) Source #

intersects :: Range a -> Range a -> Bool Source #

nonEmptyIntersection :: proxy (Range a) -> proxy (Range a) -> Intersection (Range a) (Range a) -> Bool Source #

type AlwaysTrueIntersection g h = RecApplicative (IntersectionOf g h) Source #

When using IntersectionOf we may need some constraints that are always true anyway.

defaultNonEmptyIntersection :: forall g h proxy. (NoIntersection IntersectionOf g h, RecApplicative (IntersectionOf g h)) => proxy g -> proxy h -> Intersection g h -> Bool Source #

Returns True iff the result is *not* a NoIntersection