Safe Haskell | None |
---|---|
Language | Haskell2010 |
Geom2d.Line
Contents
Description
This module describes what lines are defines functions to work with lines.
- data InfLine p a
- mkInfLine :: Eq (p a) => p a -> p a -> Maybe (InfLine p a)
- lineF :: (Eq a, Fractional a, Point p) => InfLine p a -> Maybe (a -> a)
- parallel :: (Num a, Num (p a), Point p, Eq a) => InfLine p a -> InfLine p a -> Bool
- slope :: (Fractional a, Point p, Eq a) => InfLine p a -> Maybe a
- root :: (Eq a, Fractional a, Point p) => InfLine p a -> Maybe a
- intersection :: (Eq (p a), Num (p a), RealFloat a, Point p) => InfLine p a -> InfLine p a -> Maybe (p a)
- data FinLine p a
- mkFinLine :: Eq (p a) => p a -> p a -> Maybe (FinLine p a)
- lineLength :: (Point p, Num (p a), Floating a) => FinLine p a -> a
Infinite lines
This type modells a infinite line.
Instances
Functor p => Functor (InfLine p) Source |
|
Translate p => Translate (InfLine p) Source | Translate a line by a given vector. |
(Point p, Eq a, Fractional a) => Intersect (p a) (InfLine p a) Source | |
(Eq (p a), Eq a, RealFloat a, Num (p a), Point p) => Eq (InfLine p a) Source | Two lines are equal when they have the same root and the same slope. If the two lines do not have a root, that means that the lines are parallel to the x-axis. In this case we compare their y-value. |
Read (p a) => Read (InfLine p a) Source | |
Show (p a) => Show (InfLine p a) Source | |
(Eq (p a), Arbitrary (p a)) => Arbitrary (InfLine p a) Source | |
(Point p, Eq a, Fractional a) => Intersect (InfLine p a) (p a) Source | |
(Eq (p a), Point p, Num (p a), RealFloat a) => Intersect (FinLine p a) (InfLine p a) Source | |
(Eq (p a), Point p, Num (p a), RealFloat a) => Intersect (InfLine p a) (FinLine p a) Source | |
(Eq (p a), Num (p a), Num a, RealFloat a, Point p) => Intersect (InfLine p a) (InfLine p a) Source |
mkInfLine :: Eq (p a) => p a -> p a -> Maybe (InfLine p a) Source
Construct an infinit line by specifiying two points. We won't get a line when the given points are equal.
lineF :: (Eq a, Fractional a, Point p) => InfLine p a -> Maybe (a -> a) Source
Get a function describing the line. We won't get a function if the line is vertical.
parallel :: (Num a, Num (p a), Point p, Eq a) => InfLine p a -> InfLine p a -> Bool Source
Check if two lines are paralllel to each other. This function assumes lines parallel to themselves.
slope :: (Fractional a, Point p, Eq a) => InfLine p a -> Maybe a Source
Calculate the slope of a line. We won't get a value for the slope if, and only if, the line is vertical.
root :: (Eq a, Fractional a, Point p) => InfLine p a -> Maybe a Source
Calculate the point where a line meets the x-axis. We won't get a value if, and only if the line is parallel to the x-axis.
intersection :: (Eq (p a), Num (p a), RealFloat a, Point p) => InfLine p a -> InfLine p a -> Maybe (p a) Source
Calculate the point where two lines intersect.
Finite lines
Modells a finite line stretching between two points.
Instances
Point p => Distance p (FinLine p) Source | |
Translate p => Translate (FinLine p) Source | Translate a |
Point p => Distance (FinLine p) p Source | |
Eq (p a) => Eq (FinLine p a) Source | Two lines are equal if their end points are equal. FinLine a b == FinLine b a |
Read (p a) => Read (FinLine p a) Source | |
Show (p a) => Show (FinLine p a) Source | |
(Eq (p a), Arbitrary (p a)) => Arbitrary (FinLine p a) Source | |
AEq (p a) => AEq (FinLine p a) Source | Two lines are almost equal if their ending points are almost equal. |
(Eq (p a), Point p, Num (p a), RealFloat a) => Intersect (FinLine p a) (InfLine p a) Source | |
(Eq (p a), Point p, Num (p a), RealFloat a) => Intersect (FinLine p a) (FinLine p a) Source | |
(Eq (p a), Point p, Num (p a), RealFloat a) => Intersect (InfLine p a) (FinLine p a) Source |