{-# LANGUAGE UndecidableInstances #-}
--------------------------------------------------------------------------------
-- |
-- Module      :  HGeometry.Line.Intersection
-- Copyright   :  (C) Frank Staals
-- License     :  see the LICENSE file
-- Maintainer  :  Frank Staals
--
-- Helper types for implementing line intersections
--
--------------------------------------------------------------------------------
module HGeometry.Line.Intersection
  ( LineLineIntersection, LineLineIntersectionG(..)
  ) where

import HGeometry.Point
import HGeometry.Properties (NumType)

--------------------------------------------------------------------------------

-- | Line x Line intersections are either just points or lines.
data LineLineIntersectionG r line = Line_x_Line_Point (Point 2 r)
                                  | Line_x_Line_Line line
                                  deriving (Int -> LineLineIntersectionG r line -> ShowS
[LineLineIntersectionG r line] -> ShowS
LineLineIntersectionG r line -> String
(Int -> LineLineIntersectionG r line -> ShowS)
-> (LineLineIntersectionG r line -> String)
-> ([LineLineIntersectionG r line] -> ShowS)
-> Show (LineLineIntersectionG r line)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall r line.
(Show r, Show line) =>
Int -> LineLineIntersectionG r line -> ShowS
forall r line.
(Show r, Show line) =>
[LineLineIntersectionG r line] -> ShowS
forall r line.
(Show r, Show line) =>
LineLineIntersectionG r line -> String
$cshowsPrec :: forall r line.
(Show r, Show line) =>
Int -> LineLineIntersectionG r line -> ShowS
showsPrec :: Int -> LineLineIntersectionG r line -> ShowS
$cshow :: forall r line.
(Show r, Show line) =>
LineLineIntersectionG r line -> String
show :: LineLineIntersectionG r line -> String
$cshowList :: forall r line.
(Show r, Show line) =>
[LineLineIntersectionG r line] -> ShowS
showList :: [LineLineIntersectionG r line] -> ShowS
Show,LineLineIntersectionG r line
-> LineLineIntersectionG r line -> Bool
(LineLineIntersectionG r line
 -> LineLineIntersectionG r line -> Bool)
-> (LineLineIntersectionG r line
    -> LineLineIntersectionG r line -> Bool)
-> Eq (LineLineIntersectionG r line)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall r line.
(Eq r, Eq line) =>
LineLineIntersectionG r line
-> LineLineIntersectionG r line -> Bool
$c== :: forall r line.
(Eq r, Eq line) =>
LineLineIntersectionG r line
-> LineLineIntersectionG r line -> Bool
== :: LineLineIntersectionG r line
-> LineLineIntersectionG r line -> Bool
$c/= :: forall r line.
(Eq r, Eq line) =>
LineLineIntersectionG r line
-> LineLineIntersectionG r line -> Bool
/= :: LineLineIntersectionG r line
-> LineLineIntersectionG r line -> Bool
Eq,ReadPrec [LineLineIntersectionG r line]
ReadPrec (LineLineIntersectionG r line)
Int -> ReadS (LineLineIntersectionG r line)
ReadS [LineLineIntersectionG r line]
(Int -> ReadS (LineLineIntersectionG r line))
-> ReadS [LineLineIntersectionG r line]
-> ReadPrec (LineLineIntersectionG r line)
-> ReadPrec [LineLineIntersectionG r line]
-> Read (LineLineIntersectionG r line)
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall r line.
(Read r, Read line) =>
ReadPrec [LineLineIntersectionG r line]
forall r line.
(Read r, Read line) =>
ReadPrec (LineLineIntersectionG r line)
forall r line.
(Read r, Read line) =>
Int -> ReadS (LineLineIntersectionG r line)
forall r line.
(Read r, Read line) =>
ReadS [LineLineIntersectionG r line]
$creadsPrec :: forall r line.
(Read r, Read line) =>
Int -> ReadS (LineLineIntersectionG r line)
readsPrec :: Int -> ReadS (LineLineIntersectionG r line)
$creadList :: forall r line.
(Read r, Read line) =>
ReadS [LineLineIntersectionG r line]
readList :: ReadS [LineLineIntersectionG r line]
$creadPrec :: forall r line.
(Read r, Read line) =>
ReadPrec (LineLineIntersectionG r line)
readPrec :: ReadPrec (LineLineIntersectionG r line)
$creadListPrec :: forall r line.
(Read r, Read line) =>
ReadPrec [LineLineIntersectionG r line]
readListPrec :: ReadPrec [LineLineIntersectionG r line]
Read,(forall a b.
 (a -> b) -> LineLineIntersectionG r a -> LineLineIntersectionG r b)
-> (forall a b.
    a -> LineLineIntersectionG r b -> LineLineIntersectionG r a)
-> Functor (LineLineIntersectionG r)
forall a b.
a -> LineLineIntersectionG r b -> LineLineIntersectionG r a
forall a b.
(a -> b) -> LineLineIntersectionG r a -> LineLineIntersectionG r b
forall r a b.
a -> LineLineIntersectionG r b -> LineLineIntersectionG r a
forall r a b.
(a -> b) -> LineLineIntersectionG r a -> LineLineIntersectionG r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall r a b.
(a -> b) -> LineLineIntersectionG r a -> LineLineIntersectionG r b
fmap :: forall a b.
(a -> b) -> LineLineIntersectionG r a -> LineLineIntersectionG r b
$c<$ :: forall r a b.
a -> LineLineIntersectionG r b -> LineLineIntersectionG r a
<$ :: forall a b.
a -> LineLineIntersectionG r b -> LineLineIntersectionG r a
Functor)

type LineLineIntersection line = LineLineIntersectionG (NumType line) line


-- deriving instance (Show (Point 2 (NumType line)), Show line) => Show (LineLineIntersection line)
-- deriving instance (Eq (Point 2 (NumType line)), Eq line)     => Eq (LineLineIntersection line)