hgeometry-0.6.0.0: Geometric Algorithms, Data structures, and Data types.

Safe HaskellNone
LanguageHaskell2010

Data.Geometry.Properties

Synopsis

Documentation

type family Dimension t :: Nat Source #

A type family for types that are associated with a dimension. The dimension is the dimension of the geometry they are embedded in.

Instances

type Dimension (Boundary g) Source # 
type Dimension (Image r) Source # 
type Dimension (Image r) = 2
type Dimension (IpeSymbol r) Source # 
type Dimension (IpeSymbol r) = 2
type Dimension (MiniPage r) Source # 
type Dimension (MiniPage r) = 2
type Dimension (TextLabel r) Source # 
type Dimension (TextLabel r) = 2
type Dimension (PathSegment r) Source # 
type Dimension (PathSegment r) = 2
type Dimension (Path r) Source # 
type Dimension (Path r) = 2
type Dimension (IpeObject r) Source # 
type Dimension (IpeObject r) = 2
type Dimension (Group r) Source # 
type Dimension (Group r) = 2
type Dimension (Interval a r) Source # 
type Dimension (Interval a r) = 1
type Dimension (Point d r) Source # 
type Dimension (Point d r) = d
type Dimension (Line d r) Source # 
type Dimension (Line d r) = d
type Dimension (HalfLine d r) Source # 
type Dimension (HalfLine d r) = d
type Dimension (ConvexPolygon p r) Source # 
type Dimension (ConvexPolygon p r) = 2
type Dimension (Triangle p r) Source # 
type Dimension (Triangle p r) = 2
type Dimension (SubLine d p r) Source # 
type Dimension (SubLine d p r) = d
type Dimension (Box d p r) Source # 
type Dimension (Box d p r) = d
type Dimension (LineSegment d p r) Source # 
type Dimension (LineSegment d p r) = d
type Dimension (Ball d p r) Source # 
type Dimension (Ball d p r) = d
type Dimension (PolyLine d p r) Source # 
type Dimension (PolyLine d p r) = d
type Dimension (Polygon t p r) Source # 
type Dimension (Polygon t p r) = 2

type family NumType t :: * Source #

A type family for types that have an associated numeric type.

Instances

type NumType (Range a) Source # 
type NumType (Range a) = a
type NumType (Boundary g) Source # 
type NumType (Boundary g) = NumType g
type NumType (Image r) Source # 
type NumType (Image r) = r
type NumType (IpeSymbol r) Source # 
type NumType (IpeSymbol r) = r
type NumType (MiniPage r) Source # 
type NumType (MiniPage r) = r
type NumType (TextLabel r) Source # 
type NumType (TextLabel r) = r
type NumType (PathSegment r) Source # 
type NumType (PathSegment r) = r
type NumType (Path r) Source # 
type NumType (Path r) = r
type NumType (IpeObject r) Source # 
type NumType (IpeObject r) = r
type NumType (Group r) Source # 
type NumType (Group r) = r
type NumType (I a) Source # 
type NumType (I a) = NumType a
type NumType (Interval a r) Source # 
type NumType (Interval a r) = r
type NumType (Point d r) Source # 
type NumType (Point d r) = r
type NumType (Line d r) Source # 
type NumType (Line d r) = r
type NumType (Transformation d r) Source # 
type NumType (Transformation d r) = r
type NumType (HalfLine d r) Source # 
type NumType (HalfLine d r) = r
type NumType (ConvexPolygon p r) Source # 
type NumType (ConvexPolygon p r) = r
type NumType (Triangle p r) Source # 
type NumType (Triangle p r) = r
type NumType (SubLine d p r) Source # 
type NumType (SubLine d p r) = r
type NumType (Box d p r) Source # 
type NumType (Box d p r) = r
type NumType (LineSegment d p r) Source # 
type NumType (LineSegment d p r) = r
type NumType (Ball d p r) Source # 
type NumType (Ball d p r) = r
type NumType (PolyLine d p r) Source # 
type NumType (PolyLine d p r) = r
type NumType (Polygon t p r) Source # 
type NumType (Polygon t p r) = r
type NumType (PlaneGraph k s w v e f r) Source # 
type NumType (PlaneGraph k s w v e f r) = r

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

type IntersectionOf (Range a) (Range a) Source # 
type IntersectionOf (Range a) (Range a) = (:) * NoIntersection ((:) * (Range a) ([] *))
type IntersectionOf (Line 2 r) (Boundary (Rectangle p r)) Source # 
type IntersectionOf (Line 2 r) (Boundary (Rectangle p r)) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (Point 2 r, Point 2 r) ((:) * (LineSegment 2 () r) ([] *))))
type IntersectionOf (Interval a r) (Interval a r) Source # 
type IntersectionOf (Interval a r) (Interval a r) = (:) * NoIntersection ((:) * (Interval a r) ([] *))
type IntersectionOf (Line 2 r) (Line 2 r) Source # 
type IntersectionOf (Line 2 r) (Line 2 r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (Line 2 r) ([] *)))
type IntersectionOf (Line 2 r) (Rectangle p r) Source # 
type IntersectionOf (Line 2 r) (Rectangle p r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (LineSegment 2 () r) ([] *)))
type IntersectionOf (Line 2 r) (Circle p r) Source # 
type IntersectionOf (Line 2 r) (Circle p r) = (:) * NoIntersection ((:) * (Touching (Point 2 r)) ((:) * (Point 2 r, Point 2 r) ([] *)))
type IntersectionOf (HalfLine 2 r) (HalfLine 2 r) Source # 
type IntersectionOf (HalfLine 2 r) (HalfLine 2 r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (LineSegment 2 () r) ((:) * (HalfLine 2 r) ([] *))))
type IntersectionOf (HalfLine 2 r) (Line 2 r) Source # 
type IntersectionOf (HalfLine 2 r) (Line 2 r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (HalfLine 2 r) ([] *)))
type IntersectionOf (Point d r) (Box d p r) Source # 
type IntersectionOf (Point d r) (Box d p r) = (:) * NoIntersection ((:) * (Point d r) ([] *))
type IntersectionOf (Line 2 r) (Slab o a r) Source # 
type IntersectionOf (Line 2 r) (Slab o a r) = (:) * NoIntersection ((:) * (Line 2 r) ((:) * (LineSegment 2 a r) ([] *)))
type IntersectionOf (HalfLine 2 r) (LineSegment 2 p r) Source # 
type IntersectionOf (HalfLine 2 r) (LineSegment 2 p r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (LineSegment 2 () r) ([] *)))
type IntersectionOf (LineSegment 2 p r) (Line 2 r) Source # 
type IntersectionOf (LineSegment 2 p r) (Line 2 r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (LineSegment 2 p r) ([] *)))
type IntersectionOf (LineSegment 2 p r) (Circle q r) Source # 
type IntersectionOf (LineSegment 2 p r) (Circle q r) = (:) * NoIntersection ((:) * (Touching (Point 2 r)) ((:) * (Point 2 r) ((:) * (Point 2 r, Point 2 r) ([] *))))
type IntersectionOf (SubLine 2 p r) (SubLine 2 q r) Source # 
type IntersectionOf (SubLine 2 p r) (SubLine 2 q r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (SubLine 2 p r) ([] *)))
type IntersectionOf (SubLine 2 p r) (Slab o a r) Source # 
type IntersectionOf (SubLine 2 p r) (Slab o a r) = (:) * NoIntersection ((:) * (SubLine 2 () r) ([] *))
type IntersectionOf (Box d p r) (Box d q r) Source # 
type IntersectionOf (Box d p r) (Box d q r) = (:) * NoIntersection ((:) * (Box d () r) ([] *))
type IntersectionOf (LineSegment 2 p r) (LineSegment 2 p r) Source # 
type IntersectionOf (LineSegment 2 p r) (LineSegment 2 p r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (LineSegment 2 p r) ([] *)))
type IntersectionOf (Slab o a r) (Slab o a r) Source # 
type IntersectionOf (Slab o a r) (Slab o a r) = (:) * NoIntersection ((:) * (Slab o a r) ([] *))
type IntersectionOf (Slab Horizontal a r) (Slab Vertical a r) Source # 
type IntersectionOf (Slab Horizontal a r) (Slab Vertical a r) = (:) * (Rectangle (a, a) r) ([] *)

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

Helper to produce a corec

class IsIntersectableWith g h where Source #

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.

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

Helper to implement intersects.

Instances

Ord a => IsIntersectableWith (Range a) (Range a) Source # 

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 #

Ord r => IsIntersectableWith (Interval a r) (Interval a r) Source # 

Methods

intersect :: Interval a r -> Interval a r -> Intersection (Interval a r) (Interval a r) Source #

intersects :: Interval a r -> Interval a r -> Bool Source #

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

(Eq r, Fractional r) => IsIntersectableWith (Line 2 r) (Line 2 r) Source # 

Methods

intersect :: Line 2 r -> Line 2 r -> Intersection (Line 2 r) (Line 2 r) Source #

intersects :: Line 2 r -> Line 2 r -> Bool Source #

nonEmptyIntersection :: proxy (Line 2 r) -> proxy (Line 2 r) -> Intersection (Line 2 r) (Line 2 r) -> Bool Source #

(Ord r, Floating r) => IsIntersectableWith (Line 2 r) (Circle p r) Source # 

Methods

intersect :: Line 2 r -> Circle p r -> Intersection (Line 2 r) (Circle p r) Source #

intersects :: Line 2 r -> Circle p r -> Bool Source #

nonEmptyIntersection :: proxy (Line 2 r) -> proxy (Circle p r) -> Intersection (Line 2 r) (Circle p r) -> Bool Source #

(Arity d, Ord r) => IsIntersectableWith (Point d r) (Box d p r) Source # 

Methods

intersect :: Point d r -> Box d p r -> Intersection (Point d r) (Box d p r) Source #

intersects :: Point d r -> Box d p r -> Bool Source #

nonEmptyIntersection :: proxy (Point d r) -> proxy (Box d p r) -> Intersection (Point d r) (Box d p r) -> Bool Source #

(Fractional r, Ord r, HasBoundingLines o) => IsIntersectableWith (Line 2 r) (Slab o a r) Source # 

Methods

intersect :: Line 2 r -> Slab o a r -> Intersection (Line 2 r) (Slab o a r) Source #

intersects :: Line 2 r -> Slab o a r -> Bool Source #

nonEmptyIntersection :: proxy (Line 2 r) -> proxy (Slab o a r) -> Intersection (Line 2 r) (Slab o a r) -> Bool Source #

(Ord r, Fractional r) => IsIntersectableWith (LineSegment 2 p r) (Line 2 r) Source # 

Methods

intersect :: LineSegment 2 p r -> Line 2 r -> Intersection (LineSegment 2 p r) (Line 2 r) Source #

intersects :: LineSegment 2 p r -> Line 2 r -> Bool Source #

nonEmptyIntersection :: proxy (LineSegment 2 p r) -> proxy (Line 2 r) -> Intersection (LineSegment 2 p r) (Line 2 r) -> Bool Source #

(Ord r, Floating r) => IsIntersectableWith (LineSegment 2 p r) (Circle q r) Source # 

Methods

intersect :: LineSegment 2 p r -> Circle q r -> Intersection (LineSegment 2 p r) (Circle q r) Source #

intersects :: LineSegment 2 p r -> Circle q r -> Bool Source #

nonEmptyIntersection :: proxy (LineSegment 2 p r) -> proxy (Circle q r) -> Intersection (LineSegment 2 p r) (Circle q r) -> Bool Source #

(Ord r, Fractional r) => IsIntersectableWith (SubLine 2 p r) (SubLine 2 p r) Source # 

Methods

intersect :: SubLine 2 p r -> SubLine 2 p r -> Intersection (SubLine 2 p r) (SubLine 2 p r) Source #

intersects :: SubLine 2 p r -> SubLine 2 p r -> Bool Source #

nonEmptyIntersection :: proxy (SubLine 2 p r) -> proxy (SubLine 2 p r) -> Intersection (SubLine 2 p r) (SubLine 2 p r) -> Bool Source #

(Fractional r, Ord r, HasBoundingLines o) => IsIntersectableWith (SubLine 2 a r) (Slab o a r) Source # 

Methods

intersect :: SubLine 2 a r -> Slab o a r -> Intersection (SubLine 2 a r) (Slab o a r) Source #

intersects :: SubLine 2 a r -> Slab o a r -> Bool Source #

nonEmptyIntersection :: proxy (SubLine 2 a r) -> proxy (Slab o a r) -> Intersection (SubLine 2 a r) (Slab o a r) -> Bool Source #

(Ord r, Arity d) => IsIntersectableWith (Box d p r) (Box d q r) Source # 

Methods

intersect :: Box d p r -> Box d q r -> Intersection (Box d p r) (Box d q r) Source #

intersects :: Box d p r -> Box d q r -> Bool Source #

nonEmptyIntersection :: proxy (Box d p r) -> proxy (Box d q r) -> Intersection (Box d p r) (Box d q r) -> Bool Source #

(Ord r, Fractional r) => IsIntersectableWith (LineSegment 2 p r) (LineSegment 2 p r) Source # 

Methods

intersect :: LineSegment 2 p r -> LineSegment 2 p r -> Intersection (LineSegment 2 p r) (LineSegment 2 p r) Source #

intersects :: LineSegment 2 p r -> LineSegment 2 p r -> Bool Source #

nonEmptyIntersection :: proxy (LineSegment 2 p r) -> proxy (LineSegment 2 p r) -> Intersection (LineSegment 2 p r) (LineSegment 2 p r) -> Bool Source #

Ord r => IsIntersectableWith (Slab o a r) (Slab o a r) Source # 

Methods

intersect :: Slab o a r -> Slab o a r -> Intersection (Slab o a r) (Slab o a r) Source #

intersects :: Slab o a r -> Slab o a r -> Bool Source #

nonEmptyIntersection :: proxy (Slab o a r) -> proxy (Slab o a r) -> Intersection (Slab o a r) (Slab o a r) -> Bool Source #

IsIntersectableWith (Slab Horizontal a r) (Slab Vertical a r) 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

type family Union g h :: * Source #

class IsUnionableWith g h where Source #

Minimal complete definition

union

Methods

union :: g -> h -> Union g h Source #