| Copyright | (C) Frank Staals |
|---|---|
| License | see the LICENSE file |
| Maintainer | Frank Staals |
| Safe Haskell | None |
| Language | GHC2024 |
HGeometry.Line.Class
Description
A class for types that can act as lines in d-dimensional space.
Synopsis
- class Line_ line (d :: Nat) r | line -> d, line -> r where
- fromPointAndVec :: (Point_ point d r, Line_ line d r, Num r) => point -> Vector d r -> line
- type Line2_ line r = (Line_ line 2 r, HyperPlane_ line 2 r)
- lineThrough :: forall line point (d :: Nat) r. (Line_ line d r, Point_ point d r, Num r) => point -> point -> line
- verticalLine :: forall r line. (Line_ line 2 r, Num r) => r -> line
- horizontalLine :: forall r line. (Line_ line 2 r, Num r) => r -> line
- class HasOnLine line (d :: Nat) | line -> d where
Documentation
class Line_ line (d :: Nat) r | line -> d, line -> r where Source #
Types that can act as lines in d-dimensional space.
Methods
fromPointAndVec :: (Point_ point d r, Line_ line d r, Num r) => point -> Vector d r -> line Source #
Constructs a line through a point and a vector
Instances
| (Fractional r, Eq r) => Line_ (VerticalOrLineEQ r) 2 r Source # | |
Defined in HGeometry.Line.General Methods fromPointAndVec :: (Point_ point 2 r, Line_ (VerticalOrLineEQ r) 2 r, Num r) => point -> Vector 2 r -> VerticalOrLineEQ r Source # | |
| Has_ Metric_ d r => Line_ (LinePV d r) d r Source # | |
Defined in HGeometry.Line.PointAndVector | |
type Line2_ line r = (Line_ line 2 r, HyperPlane_ line 2 r) Source #
Synonym for a line-like class.
lineThrough :: forall line point (d :: Nat) r. (Line_ line d r, Point_ point d r, Num r) => point -> point -> line Source #
Construct a line through two points.
>>>lineThrough origin (Point2 4 5) :: LinePV 2 IntLinePV (Point2 0 0) (Vector2 4 5)
verticalLine :: forall r line. (Line_ line 2 r, Num r) => r -> line Source #
Vertical line with a given X-coordinate.
horizontalLine :: forall r line. (Line_ line 2 r, Num r) => r -> line Source #
Horizontal line with a given Y-coordinate.
class HasOnLine line (d :: Nat) | line -> d where Source #
Types that have an onLine function that allows testing if a point lies on a line.
Methods
onLine :: (Point_ point d r, Num r, Eq r, r ~ NumType line, d ~ Dimension line) => point -> line -> Bool Source #
Test if the point lies on the line
>>>Point2 0 0 `onLine` lineThrough @(LinePV 2 Double) origin (Point2 1 0)True>>>Point2 10 10 `onLine` lineThrough @(LinePV 2 Double) origin (Point2 2 2)True>>>Point2 10 5 `onLine` lineThrough @(LinePV 2 Double) origin (Point2 2 2)False
Instances
| HasOnLine (VerticalOrLineEQ r) 2 Source # | |
Defined in HGeometry.Line.General Methods onLine :: (Point_ point 2 r0, Num r0, Eq r0, r0 ~ NumType (VerticalOrLineEQ r), 2 ~ Dimension (VerticalOrLineEQ r)) => point -> VerticalOrLineEQ r -> Bool Source # | |
| HasOnLine (LineEQ r) 2 Source # | |
| (Has_ Metric_ d r, Fractional r, Eq (Vector d r)) => HasOnLine (LinePV d r) d Source # | |
| Ord r => HasOnLine (LinePV 2 r) 2 Source # | |