module HGeometry.Line.NonVertical.Class
( NVLine2_
, pattern NVLine2_
, slope, intercept
) where
import Control.Lens
import HGeometry.HyperPlane.Class
import HGeometry.Line.Class
import HGeometry.Vector
type NVLine2_ line r = (Line_ line 2 r, NonVerticalHyperPlane_ line 2 r)
pattern NVLine2_ :: NonVerticalHyperPlane_ line 2 r => r -> r -> line
pattern $mNVLine2_ :: forall {r} {line} {r}.
NonVerticalHyperPlane_ line 2 r =>
line -> (r -> r -> r) -> ((# #) -> r) -> r
NVLine2_ a b <- (view hyperPlaneCoefficients -> Vector2 a b)
{-# COMPLETE NVLine2_ #-}
slope :: NonVerticalHyperPlane_ line 2 r => Lens' line r
slope :: forall line r. NonVerticalHyperPlane_ line 2 r => Lens' line r
slope = (Vector 2 r -> f (Vector 2 r)) -> line -> f line
forall hyperPlane (d :: Nat) r.
NonVerticalHyperPlane_ hyperPlane d r =>
Lens' hyperPlane (Vector d r)
Lens' line (Vector 2 r)
hyperPlaneCoefficients ((Vector 2 r -> f (Vector 2 r)) -> line -> f line)
-> ((r -> f r) -> Vector 2 r -> f (Vector 2 r))
-> (r -> f r)
-> line
-> f line
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (r -> f r) -> Vector 2 r -> f (Vector 2 r)
forall vector (d :: Nat) r.
(Vector_ vector d r, 0 <= (d - 1)) =>
IndexedLens' Int vector r
IndexedLens' Int (Vector 2 r) r
xComponent
intercept :: NonVerticalHyperPlane_ line 2 r => Lens' line r
intercept :: forall line r. NonVerticalHyperPlane_ line 2 r => Lens' line r
intercept = (Vector 2 r -> f (Vector 2 r)) -> line -> f line
forall hyperPlane (d :: Nat) r.
NonVerticalHyperPlane_ hyperPlane d r =>
Lens' hyperPlane (Vector d r)
Lens' line (Vector 2 r)
hyperPlaneCoefficients ((Vector 2 r -> f (Vector 2 r)) -> line -> f line)
-> ((r -> f r) -> Vector 2 r -> f (Vector 2 r))
-> (r -> f r)
-> line
-> f line
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (r -> f r) -> Vector 2 r -> f (Vector 2 r)
forall vector (d :: Nat) r.
(Vector_ vector d r, 1 <= (d - 1)) =>
IndexedLens' Int vector r
IndexedLens' Int (Vector 2 r) r
yComponent