| Copyright | (C) Frank Staals |
|---|---|
| License | see the LICENSE file |
| Maintainer | Frank Staals |
| Safe Haskell | None |
| Language | GHC2024 |
HGeometry.Point
Description
\(d\)-dimensional points.
Synopsis
- type Point (d :: Nat) r = PointF (Vector d r)
- newtype PointF v where
- class (Affine_ point d r, HasVector point point) => Point_ point (d :: Nat) r where
- coord' :: Int -> IndexedTraversal' Int point r
- pattern Point1_ :: Point_ point 1 r => r -> point
- pattern Point2_ :: Point_ point 2 r => r -> r -> point
- pattern Point3_ :: Point_ point 3 r => r -> r -> r -> point
- pattern Point4_ :: Point_ point 4 r => r -> r -> r -> r -> point
- class Point_ point d r => ConstructablePoint_ point (d :: Nat) r where
- fromVector :: Vector d r -> point
- class HasVector point point' where
- class (Has_ Vector_ (Dimension point) (NumType point), Has_ Vector_ (Dimension point') (NumType point'), HasComponents (Vector (Dimension point') (NumType point)) (Vector (Dimension point') (NumType point')), Dimension point ~ Dimension point', HasVector point point') => HasCoordinates point point' where
- coordinates :: IndexedTraversal1 Int point point' (NumType point) (NumType point')
- asPoint :: forall point (d :: Nat) r. Point_ point d r => Lens' point (Point d r)
- origin :: forall point (d :: Nat) r. (Num r, ConstructablePoint_ point d r) => point
- pointFromList :: forall point (d :: Nat) r. (ConstructablePoint_ point d r, Vector_ (Vector d r) d r) => [r] -> Maybe point
- coord :: forall (i :: Natural) point (d :: Natural) r. (1 <= i, i <= d, KnownNat i, Point_ point d r) => IndexedLens' Int point r
- xCoord :: forall (d :: Natural) point r. (1 <= d, Point_ point d r) => IndexedLens' Int point r
- yCoord :: forall (d :: Natural) point r. (2 <= d, Point_ point d r) => IndexedLens' Int point r
- zCoord :: forall (d :: Natural) point r. (3 <= d, Point_ point d r) => IndexedLens' Int point r
- wCoord :: forall (d :: Natural) point r. (4 <= d, Point_ point d r) => IndexedLens' Int point r
- dCoord :: forall point (d :: Natural) r. (1 <= d, Point_ point d r) => IndexedLens' Int point r
- projectPoint :: forall (i :: Nat) point (d :: Nat) r. (Point_ point d r, i <= d, Has_ Vector_ i r) => point -> Point i r
- class (Additive_ (Vector d r) d r, HasCoordinates point point, d ~ Dimension point, r ~ NumType point) => Affine_ point (d :: Nat) r | point -> d, point -> r where
- data CCW where
- ccw :: (Point_ point 2 r, Point_ point' 2 r, Point_ point'' 2 r, Num r, Ord r) => point -> point' -> point'' -> CCW
- isCoLinear :: (Point_ point 2 r, Num r, Eq r) => point -> point -> point -> Bool
- ccwCmpAround :: (Point_ center 2 r, Point_ point 2 r, Ord r, Num r) => center -> point -> point -> Ordering
- cwCmpAround :: (Point_ center 2 r, Point_ point 2 r, Ord r, Num r) => center -> point -> point -> Ordering
- ccwCmpAroundWith :: (Point_ center 2 r, Point_ point 2 r, Ord r, Num r) => Vector 2 r -> center -> point -> point -> Ordering
- cwCmpAroundWith :: (Point_ center 2 r, Point_ point 2 r, Ord r, Num r) => Vector 2 r -> center -> point -> point -> Ordering
- sortAround :: (Point_ center 2 r, Point_ point 2 r, Num r, Ord r) => center -> [point] -> [point]
- insertIntoCyclicOrder :: (Point_ center 2 r, Point_ point 2 r, Ord r, Num r) => center -> point -> CList point -> CList point
- data Quadrant
- quadrantWith :: (Ord r, Point_ point 2 r) => point -> point -> Quadrant
- quadrant :: (Ord r, Num r, ConstructablePoint_ point 2 r) => point -> Quadrant
- partitionIntoQuadrants :: (Ord r, Point_ point 2 r) => point -> [point] -> ([point], [point], [point], [point])
- cmpByDistanceTo :: forall r point (d :: Nat) center. (Ord r, Num r, Point_ point d r, Point_ center d r, Metric_ (Vector d r) d r) => center -> point -> point -> Ordering
- cmpInDirection2 :: (Num r, Ord r, Point_ point 2 r) => Vector 2 r -> point -> point -> Ordering
- squaredEuclideanDist :: forall r point (d :: Nat) point'. (Num r, Point_ point d r, Point_ point' d r, Metric_ (Vector d r) d r) => point -> point' -> r
- euclideanDist :: forall r point (d :: Nat). (Radical r, Point_ point d r, Metric_ (Vector d r) d r) => point -> point -> r
- class Metric_ (Vector (Dimension g) (NumType g)) (Dimension g) (NumType g) => HasSquaredEuclideanDistance g where
- squaredEuclideanDistTo :: forall r (d :: Nat) point. (r ~ NumType g, d ~ Dimension g, Num r, Point_ point d r) => point -> g -> r
- pointClosestTo :: forall r (d :: Nat) point. (r ~ NumType g, d ~ Dimension g, Num r, Point_ point d r) => point -> g -> Point d r
- pointClosestToWithDistance :: forall r (d :: Nat) point. (r ~ NumType g, d ~ Dimension g, Num r, Point_ point d r) => point -> g -> (Point d r, r)
- class HasPoints s t point point' | s -> point, t -> point' where
- type HasPoints' s point = HasPoints s s point point
- type CanonicalPoint geom = Point (Dimension geom) (NumType geom)
Documentation
A Point wraps a vector
Bundled Patterns
| pattern Point1 :: r -> Point 1 r | A bidirectional pattern synonym for 1 dimensional points. |
| pattern Point2 :: r -> r -> Point 2 r | A bidirectional pattern synonym for 2 dimensional points. |
| pattern Point3 :: r -> r -> r -> Point 3 r | A bidirectional pattern synonym for 3 dimensional points. |
| pattern Point4 :: r -> r -> r -> r -> Point 4 r | A bidirectional pattern synonym for 4 dimensional points. |
Instances
class (Affine_ point d r, HasVector point point) => Point_ point (d :: Nat) r where Source #
A class representing points in d-dimensional space.
Minimal complete definition
Nothing
Methods
coord' :: Int -> IndexedTraversal' Int point r Source #
Get the coordinate in a given dimension. This operation is unsafe in the
sense that no bounds are checked. Consider using coord instead.
>>>myPoint ^.. coord' 2[2]
Instances
| (Additive_ vector d r, Additive_ (Vector d r) d r) => Point_ (PointF vector) d r Source # | |
Defined in HGeometry.Point.PointF | |
| Point_ point d r => Point_ (point :+ extra) d r Source # | |
Defined in HGeometry.Point.Class | |
| (Point_ orig d r, Point_ extra d r) => Point_ (OriginalOrExtra orig extra) d r Source # | |
Defined in HGeometry.Point.Either Methods coord' :: Int -> IndexedTraversal' Int (OriginalOrExtra orig extra) r Source # | |
| (d ~ Dimension (v r), r ~ IxValue (v r), Vector_ (v r) d r, Additive_ (Vector d r) d r) => Point_ (Point v r) d r Source # | |
Defined in HGeometry.Point.Class | |
pattern Point1_ :: Point_ point 1 r => r -> point Source #
A pattern synonym for 1 dimensional points.
pattern Point2_ :: Point_ point 2 r => r -> r -> point Source #
A pattern synonym for 2 dimensional points.
pattern Point3_ :: Point_ point 3 r => r -> r -> r -> point Source #
A pattern synonym for 3 dimensional points.
pattern Point4_ :: Point_ point 4 r => r -> r -> r -> r -> point Source #
A bidirectional pattern synonym for 4 dimensional points.
class Point_ point d r => ConstructablePoint_ point (d :: Nat) r where Source #
Type class for constructable points
Methods
fromVector :: Vector d r -> point Source #
Construct a point from a vector
>>>fromVector (Vector4 1 2 3 4) :: Point 4 IntPoint4 1 2 3 4
Instances
| (Additive_ vector d r, Additive_ (Vector d r) d r) => ConstructablePoint_ (PointF vector) d r Source # | |
Defined in HGeometry.Point.PointF Methods fromVector :: Vector d r -> PointF vector Source # | |
| (ConstructablePoint_ point d r, Default extra) => ConstructablePoint_ (point :+ extra) d r Source # | |
Defined in HGeometry.Point.Class Methods fromVector :: Vector d r -> point :+ extra Source # | |
| (d ~ Dimension (v r), r ~ IxValue (v r), Vector_ (v r) d r, Additive_ (Vector d r) d r) => ConstructablePoint_ (Point v r) d r Source # | |
Defined in HGeometry.Point.Class Methods fromVector :: Vector d r -> Point v r Source # | |
class HasVector point point' where Source #
Type class for types, usually points, that have a Lens to interpret the point as a vector.
Methods
vector :: forall (d :: Nat) r s. (Dimension point ~ d, NumType point ~ r, Dimension point' ~ d, NumType point' ~ s) => Lens point point' (Vector d r) (Vector d s) Source #
Lens to access the vector corresponding to this point.
>>>myPoint ^. vectorVector3 1 2 3>>>( myPoint & vector .~ Vector3 3 2 1 ) :: Point 3 IntPoint3 3 2 1>>>(myPoint & coordinates %~ show ) :: Point 3 StringPoint3 "1" "2" "3"
Instances
| (Vector_ vector d r, Vector_ vector' d s, Has_ Vector_ d r, Has_ Vector_ d s, AsVector_ vector vector' d r s, HasComponents vector vector') => HasVector (PointF vector) (PointF vector') Source # | |
| HasVector point point' => HasVector (point :+ extra) (point' :+ extra) Source # | |
| (HasVector orig orig, HasVector extra extra, HasVector orig orig', HasVector extra extra', Dimension extra ~ Dimension orig, NumType extra ~ NumType orig, Dimension extra' ~ Dimension orig', NumType extra' ~ NumType orig') => HasVector (OriginalOrExtra orig extra) (OriginalOrExtra orig' extra') Source # | |
Defined in HGeometry.Point.Either Methods vector :: forall (d :: Nat) r s. (Dimension (OriginalOrExtra orig extra) ~ d, NumType (OriginalOrExtra orig extra) ~ r, Dimension (OriginalOrExtra orig' extra') ~ d, NumType (OriginalOrExtra orig' extra') ~ s) => Lens (OriginalOrExtra orig extra) (OriginalOrExtra orig' extra') (Vector d r) (Vector d s) Source # | |
| (Vector_ (v r) d r, Vector_ (v s) d s) => HasVector (Point v r) (Point v s) Source # | |
class (Has_ Vector_ (Dimension point) (NumType point), Has_ Vector_ (Dimension point') (NumType point'), HasComponents (Vector (Dimension point') (NumType point)) (Vector (Dimension point') (NumType point')), Dimension point ~ Dimension point', HasVector point point') => HasCoordinates point point' where Source #
Class for point types that have a type changing traversal over all coordinates.
Minimal complete definition
Nothing
Methods
coordinates :: IndexedTraversal1 Int point point' (NumType point) (NumType point') Source #
Traversal over *all* coordinates of the points. Coordinates are 1-indexed.
>>>imapMOf_ coordinates (\i x -> print (i,x)) (Point2 10 20 :: Point 2 Int)(1,10) (2,20)>>>itraverseOf coordinates (\i x -> print (i,x)) (Point2 10 20) :: IO (Point 2 ())(1,10) (2,20) Point2 () ()>>>over coordinates (+1) $ Point2 10 20 :: Point 2 IntPoint2 11 21
Instances
| (Has_ Vector_ d r, Has_ Vector_ d s, Vector_ vector d r, Vector_ vector' d s, AsVector_ vector vector' d r s, HasComponents (Vector d r) (Vector d s), HasComponents vector vector') => HasCoordinates (PointF vector) (PointF vector') Source # | |
Defined in HGeometry.Point.PointF | |
| HasCoordinates point point' => HasCoordinates (point :+ extra) (point' :+ extra) Source # | |
Defined in HGeometry.Point.Class | |
| (HasCoordinates orig orig', HasCoordinates extra extra', HasVector orig orig, HasVector extra extra, Dimension extra ~ Dimension orig, NumType extra ~ NumType orig, Dimension extra' ~ Dimension orig', NumType extra' ~ NumType orig') => HasCoordinates (OriginalOrExtra orig extra) (OriginalOrExtra orig' extra') Source # | |
Defined in HGeometry.Point.Either Methods coordinates :: IndexedTraversal1 Int (OriginalOrExtra orig extra) (OriginalOrExtra orig' extra') (NumType (OriginalOrExtra orig extra)) (NumType (OriginalOrExtra orig' extra')) Source # | |
| (d ~ Dimension (v r), r ~ IxValue (v r), s ~ IxValue (v s), d ~ Dimension (v s), Vector_ (v r) d r, Vector_ (v s) d s, Has_ Vector_ d r, Has_ Vector_ d s, HasComponents (Vector d r) (Vector d s)) => HasCoordinates (Point v r) (Point v s) Source # | |
Defined in HGeometry.Point.Class | |
asPoint :: forall point (d :: Nat) r. Point_ point d r => Lens' point (Point d r) Source #
Convert a generic point into a Point d r, dropping any additional information we may now about it.
origin :: forall point (d :: Nat) r. (Num r, ConstructablePoint_ point d r) => point Source #
Point representing the origin in d dimensions
>>>origin :: Point 4 IntPoint4 0 0 0 0
pointFromList :: forall point (d :: Nat) r. (ConstructablePoint_ point d r, Vector_ (Vector d r) d r) => [r] -> Maybe point Source #
Constructs a point from a list of coordinates. The length of the list has to match the dimension exactly.
>>>pointFromList [1,2,3] :: Maybe (Point 3 Int)Just (Point3 1 2 3)>>>pointFromList [1] :: Maybe (Point 3 Int)Nothing>>>pointFromList [1,2,3,4] :: Maybe (Point 3 Int)Nothing
coord :: forall (i :: Natural) point (d :: Natural) r. (1 <= i, i <= d, KnownNat i, Point_ point d r) => IndexedLens' Int point r Source #
Get the coordinate in a given dimension
>>>myPoint ^. coord @22>>>myPoint & coord @1 .~ 10Point3 10 2 3>>>myPoint & coord @3 %~ (+1)Point3 1 2 4
xCoord :: forall (d :: Natural) point r. (1 <= d, Point_ point d r) => IndexedLens' Int point r Source #
Shorthand to access the first coordinate
>>>myPoint ^. xCoord1>>>Point2 1 (2 :: Int) & xCoord .~ 10Point2 10 2
yCoord :: forall (d :: Natural) point r. (2 <= d, Point_ point d r) => IndexedLens' Int point r Source #
Shorthand to access the second coordinate
>>>Point2 1 (2 :: Int) ^. yCoord2>>>myPoint & yCoord %~ (+1)Point3 1 3 3
zCoord :: forall (d :: Natural) point r. (3 <= d, Point_ point d r) => IndexedLens' Int point r Source #
Shorthand to access the third coordinate
>>>myPoint ^. zCoord3>>>myPoint & zCoord %~ (+1)Point3 1 2 4
wCoord :: forall (d :: Natural) point r. (4 <= d, Point_ point d r) => IndexedLens' Int point r Source #
Shorthand to access the fourth coordinate
>>>(Point4 1 2 3 4 :: Point 4 Int) ^. wCoord4>>>(Point4 1 2 3 4 :: Point 4 Int) & wCoord %~ (+1)Point4 1 2 3 5
dCoord :: forall point (d :: Natural) r. (1 <= d, Point_ point d r) => IndexedLens' Int point r Source #
Shorthand to access the last coordinate
>>>(Point2 1 2 :: Point 2 Int) ^. dCoord2>>>(Point4 1 2 3 4 :: Point 4 Int) ^. dCoord4>>>(Point4 1 2 3 4 :: Point 4 Int) & dCoord %~ (+1)Point4 1 2 3 5
projectPoint :: forall (i :: Nat) point (d :: Nat) r. (Point_ point d r, i <= d, Has_ Vector_ i r) => point -> Point i r Source #
Project a point into a lower dimension.
class (Additive_ (Vector d r) d r, HasCoordinates point point, d ~ Dimension point, r ~ NumType point) => Affine_ point (d :: Nat) r | point -> d, point -> r where Source #
Affine space; essentially the same as Linear.Affine, but for points of kind Type rather than (Type -> Type).
Minimal complete definition
Nothing
Methods
(.-.) :: point -> point -> Vector d r Source #
p .-. q represents the vector from q to p
(.+^) :: point -> Vector d r -> point Source #
add a vector to a point
>>>myPoint .+^ Vector3 100 200 300Point3 101 202 303
(.-^) :: point -> Vector d r -> point Source #
subtract a vector from a point
>>>myPoint .-^ Vector3 100 200 300Point3 (-99) (-198) (-297)
Instances
| (Additive_ vector d r, Additive_ (Vector d r) d r) => Affine_ (PointF vector) d r Source # | |
| Affine_ point d r => Affine_ (point :+ extra) d r Source # | |
| (Affine_ orig d r, Affine_ extra d r) => Affine_ (OriginalOrExtra orig extra) d r Source # | |
Defined in HGeometry.Point.Either Methods (.-.) :: OriginalOrExtra orig extra -> OriginalOrExtra orig extra -> Vector d r Source # (.+^) :: OriginalOrExtra orig extra -> Vector d r -> OriginalOrExtra orig extra Source # (.-^) :: OriginalOrExtra orig extra -> Vector d r -> OriginalOrExtra orig extra Source # | |
| (d ~ Dimension (v r), r ~ IxValue (v r), Vector_ (v r) d r, Additive_ (Vector d r) d r) => Affine_ (Point v r) d r Source # | |
Data type for expressing the orientation of three points, with the option of allowing Colinearities.
Bundled Patterns
| pattern CCW :: CCW | CounterClockwise orientation. Also called a left-turn. |
| pattern CW :: CCW | Clockwise orientation. Also called a right-turn. |
| pattern CoLinear :: CCW | CoLinear orientation. Also called a straight line. |
ccw :: (Point_ point 2 r, Point_ point' 2 r, Point_ point'' 2 r, Num r, Ord r) => point -> point' -> point'' -> CCW Source #
Given three points p q and r determine the orientation when going from p to r via q.
Be wary of numerical instability: >>> ccw (Point2 0 0.3) (Point2 1 0.6) (Point2 2 (0.9::Double)) CCW
>>>ccw (Point2 0 0.3) (Point2 1 0.6) (Point2 2 (0.9::Rational))CoLinear
isCoLinear :: (Point_ point 2 r, Num r, Eq r) => point -> point -> point -> Bool Source #
Given three points p q and r determine if the line from p to r via q is straight/colinear.
This is identical to `ccw p q r == CoLinear` but doesn't have the Ord constraint.
ccwCmpAround :: (Point_ center 2 r, Point_ point 2 r, Ord r, Num r) => center -> point -> point -> Ordering Source #
Counter clockwise ordering of the points around c. Points are ordered with respect to the positive x-axis.
cwCmpAround :: (Point_ center 2 r, Point_ point 2 r, Ord r, Num r) => center -> point -> point -> Ordering Source #
Clockwise ordering of the points around c. Points are ordered with respect to the positive x-axis.
ccwCmpAroundWith :: (Point_ center 2 r, Point_ point 2 r, Ord r, Num r) => Vector 2 r -> center -> point -> point -> Ordering Source #
Given a zero vector z, a center c, and two points p and q, compute the ccw ordering of p and q around c with this vector as zero direction.
pre: the points p,q /= c
cwCmpAroundWith :: (Point_ center 2 r, Point_ point 2 r, Ord r, Num r) => Vector 2 r -> center -> point -> point -> Ordering Source #
Given a zero vector z, a center c, and two points p and q, compute the cw ordering of p and q around c with this vector as zero direction.
pre: the points p,q /= c
sortAround :: (Point_ center 2 r, Point_ point 2 r, Num r, Ord r) => center -> [point] -> [point] Source #
Sort the points arround the given point p in counter clockwise order with respect to the rightward horizontal ray starting from p. If two points q and r are colinear with p, the closest one to p is reported first.
\( O(n log n) \)
insertIntoCyclicOrder :: (Point_ center 2 r, Point_ point 2 r, Ord r, Num r) => center -> point -> CList point -> CList point Source #
\( O(n) \) Given a center c, a new point p, and a list of points ps, sorted in counter clockwise order around c. Insert p into the cyclic order. The focus of the returned cyclic list is the new point p.
Quadrants of two dimensional points. in CCW order
Constructors
| TopRight | |
| TopLeft | |
| BottomLeft | |
| BottomRight |
Instances
| Bounded Quadrant Source # | |
| Enum Quadrant Source # | |
Defined in HGeometry.Point.Quadrants Methods succ :: Quadrant -> Quadrant Source # pred :: Quadrant -> Quadrant Source # toEnum :: Int -> Quadrant Source # fromEnum :: Quadrant -> Int Source # enumFrom :: Quadrant -> [Quadrant] Source # enumFromThen :: Quadrant -> Quadrant -> [Quadrant] Source # enumFromTo :: Quadrant -> Quadrant -> [Quadrant] Source # enumFromThenTo :: Quadrant -> Quadrant -> Quadrant -> [Quadrant] Source # | |
| Read Quadrant Source # | |
| Show Quadrant Source # | |
| Eq Quadrant Source # | |
| Ord Quadrant Source # | |
Defined in HGeometry.Point.Quadrants | |
quadrantWith :: (Ord r, Point_ point 2 r) => point -> point -> Quadrant Source #
Quadrants around point c; quadrants are closed on their "previous" boundary (i..e the boundary with the previous quadrant in the CCW order), open on next boundary. The origin itself is assigned the topRight quadrant
quadrant :: (Ord r, Num r, ConstructablePoint_ point 2 r) => point -> Quadrant Source #
Quadrants with respect to the origin
partitionIntoQuadrants :: (Ord r, Point_ point 2 r) => point -> [point] -> ([point], [point], [point], [point]) Source #
Given a center point c, and a set of points, partition the points into quadrants around c (based on their x and y coordinates). The quadrants are reported in the order topLeft, topRight, bottomLeft, bottomRight. The points are in the same order as they were in the original input lists. Points with the same x-or y coordinate as p, are "rounded" to above.
cmpByDistanceTo :: forall r point (d :: Nat) center. (Ord r, Num r, Point_ point d r, Point_ center d r, Metric_ (Vector d r) d r) => center -> point -> point -> Ordering Source #
Compare two points by their distance to the first argument
cmpInDirection2 :: (Num r, Ord r, Point_ point 2 r) => Vector 2 r -> point -> point -> Ordering Source #
Comparison that compares which point is larger in the direction given by
the vector u.
squaredEuclideanDist :: forall r point (d :: Nat) point'. (Num r, Point_ point d r, Point_ point' d r, Metric_ (Vector d r) d r) => point -> point' -> r Source #
Squared Euclidean distance between two points
euclideanDist :: forall r point (d :: Nat). (Radical r, Point_ point d r, Metric_ (Vector d r) d r) => point -> point -> r Source #
Euclidean distance between two points
class Metric_ (Vector (Dimension g) (NumType g)) (Dimension g) (NumType g) => HasSquaredEuclideanDistance g where Source #
Types for which we can compute the squared Euclidean distance.
Minimal complete definition
Methods
squaredEuclideanDistTo :: forall r (d :: Nat) point. (r ~ NumType g, d ~ Dimension g, Num r, Point_ point d r) => point -> g -> r Source #
Given a point q and a geometry g, the squared Euclidean distance between q and g.
pointClosestTo :: forall r (d :: Nat) point. (r ~ NumType g, d ~ Dimension g, Num r, Point_ point d r) => point -> g -> Point d r Source #
Given q and g, computes the point p in g closest to q according to the Squared Euclidean distance.
pointClosestToWithDistance :: forall r (d :: Nat) point. (r ~ NumType g, d ~ Dimension g, Num r, Point_ point d r) => point -> g -> (Point d r, r) Source #
Given q and g, computes the point p in g closest to q according to the Squared Euclidean distance. Returns both the point and the distance realized by this point.
Instances
| (Vector_ v d r, Metric_ (Vector d r) d r) => HasSquaredEuclideanDistance (PointF v) Source # | |
Defined in HGeometry.Point.EuclideanDistance Methods squaredEuclideanDistTo :: forall r0 (d0 :: Nat) point. (r0 ~ NumType (PointF v), d0 ~ Dimension (PointF v), Num r0, Point_ point d0 r0) => point -> PointF v -> r0 Source # pointClosestTo :: forall r0 (d0 :: Nat) point. (r0 ~ NumType (PointF v), d0 ~ Dimension (PointF v), Num r0, Point_ point d0 r0) => point -> PointF v -> Point d0 r0 Source # pointClosestToWithDistance :: forall r0 (d0 :: Nat) point. (r0 ~ NumType (PointF v), d0 ~ Dimension (PointF v), Num r0, Point_ point d0 r0) => point -> PointF v -> (Point d0 r0, r0) Source # | |
| HasSquaredEuclideanDistance p => HasSquaredEuclideanDistance (p :+ extra) Source # | |
Defined in HGeometry.Point.EuclideanDistance Methods squaredEuclideanDistTo :: forall r (d :: Nat) point. (r ~ NumType (p :+ extra), d ~ Dimension (p :+ extra), Num r, Point_ point d r) => point -> (p :+ extra) -> r Source # pointClosestTo :: forall r (d :: Nat) point. (r ~ NumType (p :+ extra), d ~ Dimension (p :+ extra), Num r, Point_ point d r) => point -> (p :+ extra) -> Point d r Source # pointClosestToWithDistance :: forall r (d :: Nat) point. (r ~ NumType (p :+ extra), d ~ Dimension (p :+ extra), Num r, Point_ point d r) => point -> (p :+ extra) -> (Point d r, r) Source # | |
class HasPoints s t point point' | s -> point, t -> point' where Source #
Data types that store points
Methods
allPoints :: forall (d :: Nat) r r'. (Point_ point d r, Point_ point' d r', NumType s ~ r, NumType t ~ r', Dimension s ~ d, Dimension t ~ d) => Traversal1 s t point point' Source #
Traversal over all points in the structure
>>>let xs = NonEmpty.fromList [Point2 10 10, Point2 20 (30 :: Int)]>>>xs^..allPoints[Point2 10 10,Point2 20 30]>>>over allPoints (.+^ Vector2 10 10) xs :: NonEmpty.NonEmpty (Point 2 Int)Point2 20 20 :| [Point2 30 40]
type HasPoints' s point = HasPoints s s point point Source #
Shorthand for 'HasPoints s s point point'