| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Geometry.Properties
- type family Dimension t :: Nat
- type family NumType t :: *
- data NoIntersection = NoIntersection
- type Intersection g h = CoRec Identity (IntersectionOf g h)
- type family IntersectionOf g h :: [*]
- coRec :: a ∈ as => a -> CoRec Identity as
- class IsIntersectableWith g h where
- intersect :: g -> h -> Intersection g h
- intersects :: g -> h -> Bool
- nonEmptyIntersection :: proxy g -> proxy h -> Intersection g h -> Bool
- type AlwaysTrueIntersection g h = RecApplicative (IntersectionOf g h)
- defaultNonEmptyIntersection :: forall g h proxy. (NoIntersection ∈ IntersectionOf g h, RecApplicative (IntersectionOf g h)) => proxy g -> proxy h -> Intersection g h -> Bool
- type family Union g h :: *
- class IsUnionableWith g h where
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) = Dimension g Source | |
| type Dimension (Image r) = 2 Source | |
| type Dimension (IpeSymbol r) = 2 Source | |
| type Dimension (MiniPage r) = 2 Source | |
| type Dimension (TextLabel r) = 2 Source | |
| type Dimension (PathSegment r) = 2 Source | |
| type Dimension (Path r) = 2 Source | |
| type Dimension (IpeObject r) = 2 Source | |
| type Dimension (Group r) = 2 Source | |
| type Dimension (Point d r) = d Source | |
| type Dimension (Interval a r) = 1 Source | |
| type Dimension (Line d r) = d Source | |
| type Dimension (HalfLine d r) = d Source | |
| type Dimension (Triangle p r) = 2 Source | |
| type Dimension (Box d p r) = d Source | |
| type Dimension (SubLine d p r) = d Source | |
| type Dimension (LineSegment d p r) = d Source | |
| type Dimension (PolyLine d p r) = d Source | |
| type Dimension (Polygon t p r) = 2 Source | Polygons are per definition 2 dimensional |
| type Dimension (Ball d p r) = d Source |
type family NumType t :: * Source
A type family for types that have an associated numeric type.
Instances
| type NumType (Boundary g) = NumType g Source | |
| type NumType (Image r) = r Source | |
| type NumType (IpeSymbol r) = r Source | |
| type NumType (MiniPage r) = r Source | |
| type NumType (TextLabel r) = r Source | |
| type NumType (PathSegment r) = r Source | |
| type NumType (Path r) = r Source | |
| type NumType (IpeObject r) = r Source | |
| type NumType (Group r) = r Source | |
| type NumType (Point d r) = r Source | |
| type NumType (Transformation d r) = r Source | |
| type NumType (Interval a r) = r Source | |
| type NumType (Line d r) = r Source | |
| type NumType (HalfLine d r) = r Source | |
| type NumType (Triangle p r) = r Source | |
| type NumType (Box d p r) = r Source | |
| type NumType (SubLine d p r) = r Source | |
| type NumType (LineSegment d p r) = r Source | |
| type NumType (PolyLine d p r) = r Source | |
| type NumType (Polygon t p r) = r Source | |
| type NumType (Ball d p r) = r Source |
data NoIntersection Source
A simple data type expressing that there are no intersections
Constructors
| NoIntersection |
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) = (:) * NoIntersection ((:) * (Range a) ([] *)) Source | |
| type IntersectionOf (Line 2 r) (Boundary (Rectangle p r)) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (Point 2 r, Point 2 r) ((:) * (LineSegment 2 () r) ([] *)))) Source | |
| type IntersectionOf (Interval a r) (Interval a r) = (:) * NoIntersection ((:) * (Interval a r) ([] *)) Source | |
| type IntersectionOf (Line 2 r) (Line 2 r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (Line 2 r) ([] *))) Source | The intersection of two lines is either: NoIntersection, a point or a line. |
| type IntersectionOf (Line 2 r) (Rectangle p r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (LineSegment 2 () r) ([] *))) Source | |
| type IntersectionOf (Line 2 r) (Circle p r) = (:) * NoIntersection ((:) * (Touching (Point 2 r)) ((:) * (Point 2 r, Point 2 r) ([] *))) Source | No intersection, one touching point, or two points |
| type IntersectionOf (HalfLine 2 r) (HalfLine 2 r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (LineSegment 2 () r) ((:) * (HalfLine 2 r) ([] *)))) Source | |
| type IntersectionOf (HalfLine 2 r) (Line 2 r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (HalfLine 2 r) ([] *))) Source | |
| type IntersectionOf (Line 2 r) (Slab o a r) = (:) * NoIntersection ((:) * (Line 2 r) ((:) * (LineSegment 2 a r) ([] *))) Source | |
| type IntersectionOf (HalfLine 2 r) (LineSegment 2 p r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (LineSegment 2 () r) ([] *))) Source | |
| type IntersectionOf (LineSegment 2 p r) (Line 2 r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (LineSegment 2 p 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) ([] *)))) Source | A line segment may not intersect a circle, touch it, or intersect it properly in one or two points. |
| type IntersectionOf (Box d p r) (Box d q r) = (:) * NoIntersection ((:) * (Box d () r) ([] *)) Source | |
| type IntersectionOf (SubLine 2 p r) (SubLine 2 q r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (SubLine 2 p r) ([] *))) Source | |
| type IntersectionOf (SubLine 2 p r) (Slab o a r) = (:) * NoIntersection ((:) * (SubLine 2 a r) ((:) * (LineSegment 2 a r) ([] *))) Source | |
| type IntersectionOf (LineSegment 2 p r) (LineSegment 2 p r) = (:) * NoIntersection ((:) * (Point 2 r) ((:) * (LineSegment 2 p r) ([] *))) Source | |
| type IntersectionOf (Slab o a r) (Slab o a r) = (:) * NoIntersection ((:) * (Slab o a r) ([] *)) Source | |
| type IntersectionOf (Slab Horizontal a r) (Slab Vertical a r) = (:) * (Rectangle (a, a) r) ([] *) Source |
class IsIntersectableWith g h where Source
Minimal complete definition
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
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 resultt is a NoIntersection
class IsUnionableWith g h where Source