GeomAlg-0.2.3: Library of geometric algorithms in HaskellSource codeContentsIndex
GeomAlg.Point
Contents
The Point class
Ordering relations on points.
Containedness in intervals
Norm, length and distance
Description
The type class Point defines all operations on points. This type class is instanciated by the different data types of points Point1, Point2, Point3, Point4 and PointN.
Synopsis
class Functor p => Point p where
origin :: Num a => p a
dimension :: Num a => p a -> Int
ith :: Num a => Int -> p a -> a
(<==>) :: Num a => p a -> p a -> Bool
(</=>) :: Num a => p a -> p a -> Bool
(<+>) :: Num a => p a -> p a -> p a
(<->) :: Num a => p a -> p a -> p a
negateP :: Num a => p a -> p a
(<.>) :: Num a => p a -> p a -> a
(<*>) :: Num a => a -> p a -> p a
toList :: (Point p, Num a) => p a -> [a]
xcoord :: (Num a, Point p) => p a -> a
ycoord :: (Num a, Point p) => p a -> a
zcoord :: (Num a, Point p) => p a -> a
lexic :: (Point p, Num a, Ord a) => OrderRel (p a)
lessIth :: (Point p, Ord a, Num a) => Int -> Rel (p a)
leqIth :: (Point p, Ord a, Num a) => Int -> Rel (p a)
equalIth :: (Point p, Ord a, Num a) => Int -> Rel (p a)
geqIth :: (Point p, Ord a, Num a) => Int -> Rel (p a)
greaterIth :: (Point p, Ord a, Num a) => Int -> Rel (p a)
compareIthBy :: (Num a, Point p) => OrderRel a -> Int -> OrderRel (p a)
compareIth :: (Ord a, Num a, Point p) => Int -> OrderRel (p a)
inIntervalIth :: (Point p, Num a, Ord a) => Int -> p a -> (p a, p a) -> Bool
inInterval :: (Point p, Num a, Ord a) => p a -> (p a, p a) -> Bool
norm :: (Point p, Floating a) => p a -> a
distance :: (Point p, Floating a) => p a -> p a -> a
sqrDistance :: (Point p, Num a) => p a -> p a -> a
The Point class
class Functor p => Point p whereSource
This type class defines all operations on points.
Methods
origin :: Num a => p aSource
The origin.
dimension :: Num a => p a -> IntSource
The dimension.
ith :: Num a => Int -> p a -> aSource
The ith component, aka x-, y- and z-coordinates.
(<==>) :: Num a => p a -> p a -> BoolSource
Equality.
(</=>) :: Num a => p a -> p a -> BoolSource
Inequality.
(<+>) :: Num a => p a -> p a -> p aSource
Addition.
(<->) :: Num a => p a -> p a -> p aSource
Subtraction.
negateP :: Num a => p a -> p aSource
Unary negation
(<.>) :: Num a => p a -> p a -> aSource
Dot product
(<*>) :: Num a => a -> p a -> p aSource
Scalar multiplication from the left
show/hide Instances
toList :: (Point p, Num a) => p a -> [a]Source
Puts all coordinates into a list.
xcoord :: (Num a, Point p) => p a -> aSource
The first coordinate, traditionally called x coordinate.
ycoord :: (Num a, Point p) => p a -> aSource
The second coordinate, traditionally called y coordinate.
zcoord :: (Num a, Point p) => p a -> aSource
The third coordinate, traditionally called z coordinate.
Ordering relations on points.
lexic :: (Point p, Num a, Ord a) => OrderRel (p a)Source
Lexicographic ordering
lessIth :: (Point p, Ord a, Num a) => Int -> Rel (p a)Source
Less-than relation for the ith dimension.
leqIth :: (Point p, Ord a, Num a) => Int -> Rel (p a)Source
Less-than-or-equal relation for the ith dimension.
equalIth :: (Point p, Ord a, Num a) => Int -> Rel (p a)Source
Equality relation for the ith dimension.
geqIth :: (Point p, Ord a, Num a) => Int -> Rel (p a)Source
Greater-than-or-equal relation for the ith dimension.
greaterIth :: (Point p, Ord a, Num a) => Int -> Rel (p a)Source
Greater-than relation for the ith dimension.
compareIthBy :: (Num a, Point p) => OrderRel a -> Int -> OrderRel (p a)Source
Lift a OrderRel to the ith coordinate of the points x and y.
compareIth :: (Ord a, Num a, Point p) => Int -> OrderRel (p a)Source
Compares the ith coordinate.
Containedness in intervals
inIntervalIth :: (Point p, Num a, Ord a) => Int -> p a -> (p a, p a) -> BoolSource
Test containedness in an (closed) interval in one dimension.
inInterval :: (Point p, Num a, Ord a) => p a -> (p a, p a) -> BoolSource
Test containedness in an (closed) interval in all dimensions.
Norm, length and distance
norm :: (Point p, Floating a) => p a -> aSource
The norm
distance :: (Point p, Floating a) => p a -> p a -> aSource
The distance between p and q.
sqrDistance :: (Point p, Num a) => p a -> p a -> aSource
The square of the distance.
Produced by Haddock version 2.4.2