Intersection

Intersections are implemented for various geometries such as Segment, Line, and Box:

s1 = Segment((0.0,0.0), (1.0,0.0))
s2 = Segment((0.5,0.0), (2.0,0.0))

s1 ∩ s2
Segment{2,Float64}
  └─Point(0.5, 0.0)
  └─Point(1.0, 0.0)

The algorithm first identifies the type of intersection using intersecttype:

I = intersecttype(s1, s2)
OverlappingSegments{Segment{2, Float64, StaticArrays.SVector{2, Point2}}}(Segment(Point(0.5, 0.0), Point(1.0, 0.0)))

and then retrieves the actual value using get:

get(I)
Segment{2,Float64}
  └─Point(0.5, 0.0)
  └─Point(1.0, 0.0)