module HGeometry.Line.Class
( Line_(..)
, Line2_
, lineThrough
, verticalLine, horizontalLine
, HasOnLine(..)
) where
import HGeometry.HyperPlane.Class
import HGeometry.Point.Class
import HGeometry.Point.PointF
import HGeometry.Properties
import HGeometry.Vector
class Line_ line d r | line -> d
, line -> r where
fromPointAndVec :: ( Point_ point d r
, Line_ line d r
, Num r
) => point -> Vector d r -> line
lineThrough :: forall line point d r.
( Line_ line d r
, Point_ point d r
, Num r
) => point -> point -> line
lineThrough :: forall line point (d :: Nat) r.
(Line_ line d r, Point_ point d r, Num r) =>
point -> point -> line
lineThrough point
p point
q = point -> Vector d r -> line
forall point.
(Point_ point d r, Line_ line d r, Num r) =>
point -> Vector d r -> line
forall line (d :: Nat) r point.
(Line_ line d r, Point_ point d r, Line_ line d r, Num r) =>
point -> Vector d r -> line
fromPointAndVec point
p (point
q point -> point -> Vector d r
forall point (d :: Nat) r.
(Affine_ point d r, Num r) =>
point -> point -> Vector d r
.-. point
p)
type Line2_ line r = (Line_ line 2 r, HyperPlane_ line 2 r)
verticalLine :: forall r line.
( Line_ line 2 r, Num r)
=> r -> line
verticalLine :: forall r line. (Line_ line 2 r, Num r) => r -> line
verticalLine r
x = PointF (Vector 2 r) -> Vector 2 r -> line
forall point.
(Point_ point 2 r, Line_ line 2 r, Num r) =>
point -> Vector 2 r -> line
forall line (d :: Nat) r point.
(Line_ line d r, Point_ point d r, Line_ line d r, Num r) =>
point -> Vector d r -> line
fromPointAndVec (Vector 2 r -> PointF (Vector 2 r)
forall v. v -> PointF v
Point (Vector 2 r -> PointF (Vector 2 r))
-> Vector 2 r -> PointF (Vector 2 r)
forall a b. (a -> b) -> a -> b
$ r -> r -> Vector 2 r
forall r. r -> r -> Vector 2 r
Vector2 r
x r
0) (r -> r -> Vector 2 r
forall r. r -> r -> Vector 2 r
Vector2 r
0 r
1)
horizontalLine :: forall r line. (Line_ line 2 r, Num r)
=> r -> line
horizontalLine :: forall r line. (Line_ line 2 r, Num r) => r -> line
horizontalLine r
y = PointF (Vector 2 r) -> Vector 2 r -> line
forall point.
(Point_ point 2 r, Line_ line 2 r, Num r) =>
point -> Vector 2 r -> line
forall line (d :: Nat) r point.
(Line_ line d r, Point_ point d r, Line_ line d r, Num r) =>
point -> Vector d r -> line
fromPointAndVec (Vector 2 r -> PointF (Vector 2 r)
forall v. v -> PointF v
Point (Vector 2 r -> PointF (Vector 2 r))
-> Vector 2 r -> PointF (Vector 2 r)
forall a b. (a -> b) -> a -> b
$ r -> r -> Vector 2 r
forall r. r -> r -> Vector 2 r
Vector2 r
0 r
y) (r -> r -> Vector 2 r
forall r. r -> r -> Vector 2 r
Vector2 r
1 r
0)
class HasOnLine line d | line -> d where
onLine :: ( Point_ point d r, Num r, Eq r
, r ~ NumType line, d ~ Dimension line
) => point -> line -> Bool