hgeometry-polygon
Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageGHC2024

HGeometry.Polygon.Convex.Unbounded

Description

A type for representing unbounded, Convex, polygonal regions.

Synopsis

Documentation

type UnboundedConvexRegion vertex = UnboundedConvexRegionF (NumType vertex) NonEmpty vertex Source #

An unbounded polygonal Convex Region

data UnboundedConvexRegionF r (nonEmpty :: Type -> Type) vertex Source #

An unbounded polygonal ConvexRegion whose vertices are stored in an nonEmpty

Constructors

Unbounded 

Fields

  • (Vector 2 r)

    vector indicating the direction of the unbounded edge incident to the first vertex. Note that this vector thus points INTO vertex v.

  • (nonEmpty vertex)

    the vertices in CCW order,

  • (Vector 2 r)

    the vector indicating the direction of the unbounded edge incident to the last vertex. The vector points away from the vertex (i.e. towards +infty).

Instances

Instances details
(Point_ vertex 2 r, Point_ corner 2 r, Ord r, Fractional r) => HasIntersectionWith (Rectangle corner) (UnboundedConvexRegionF r NonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

(Point_ vertex 2 r, Num r, Ord r, HyperPlane_ line 2 r, HasIntersectionWith (HalfLine vertex) (HalfPlaneF line)) => HasIntersectionWith (HalfPlaneF line) (UnboundedConvexRegionF r NonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

(Point_ vertex 2 r, Point_ corner 2 r, Ord r, Fractional r) => HasIntersectionWith (Triangle corner) (UnboundedConvexRegionF r NonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

(Point_ vertex 2 r, Point_ corner 2 r, Ord r, Fractional r) => IsIntersectableWith (Rectangle corner) (UnboundedConvexRegionF r NonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

(Point_ vertex 2 r, Point_ corner 2 r, Ord r, Fractional r) => IsIntersectableWith (Triangle corner) (UnboundedConvexRegionF r NonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

Functor nonEmpty => Functor (UnboundedConvexRegionF r nonEmpty) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

Methods

fmap :: (a -> b) -> UnboundedConvexRegionF r nonEmpty a -> UnboundedConvexRegionF r nonEmpty b Source #

(<$) :: a -> UnboundedConvexRegionF r nonEmpty b -> UnboundedConvexRegionF r nonEmpty a Source #

Foldable nonEmpty => Foldable (UnboundedConvexRegionF r nonEmpty) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

Methods

fold :: Monoid m => UnboundedConvexRegionF r nonEmpty m -> m Source #

foldMap :: Monoid m => (a -> m) -> UnboundedConvexRegionF r nonEmpty a -> m Source #

foldMap' :: Monoid m => (a -> m) -> UnboundedConvexRegionF r nonEmpty a -> m Source #

foldr :: (a -> b -> b) -> b -> UnboundedConvexRegionF r nonEmpty a -> b Source #

foldr' :: (a -> b -> b) -> b -> UnboundedConvexRegionF r nonEmpty a -> b Source #

foldl :: (b -> a -> b) -> b -> UnboundedConvexRegionF r nonEmpty a -> b Source #

foldl' :: (b -> a -> b) -> b -> UnboundedConvexRegionF r nonEmpty a -> b Source #

foldr1 :: (a -> a -> a) -> UnboundedConvexRegionF r nonEmpty a -> a Source #

foldl1 :: (a -> a -> a) -> UnboundedConvexRegionF r nonEmpty a -> a Source #

toList :: UnboundedConvexRegionF r nonEmpty a -> [a] Source #

null :: UnboundedConvexRegionF r nonEmpty a -> Bool Source #

length :: UnboundedConvexRegionF r nonEmpty a -> Int Source #

elem :: Eq a => a -> UnboundedConvexRegionF r nonEmpty a -> Bool Source #

maximum :: Ord a => UnboundedConvexRegionF r nonEmpty a -> a Source #

minimum :: Ord a => UnboundedConvexRegionF r nonEmpty a -> a Source #

sum :: Num a => UnboundedConvexRegionF r nonEmpty a -> a Source #

product :: Num a => UnboundedConvexRegionF r nonEmpty a -> a Source #

Traversable nonEmpty => Traversable (UnboundedConvexRegionF r nonEmpty) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

Methods

traverse :: Applicative f => (a -> f b) -> UnboundedConvexRegionF r nonEmpty a -> f (UnboundedConvexRegionF r nonEmpty b) Source #

sequenceA :: Applicative f => UnboundedConvexRegionF r nonEmpty (f a) -> f (UnboundedConvexRegionF r nonEmpty a) Source #

mapM :: Monad m => (a -> m b) -> UnboundedConvexRegionF r nonEmpty a -> m (UnboundedConvexRegionF r nonEmpty b) Source #

sequence :: Monad m => UnboundedConvexRegionF r nonEmpty (m a) -> m (UnboundedConvexRegionF r nonEmpty a) Source #

(Point_ vertex 2 r, Ord r, Fractional r) => HasIntersectionWith (LinePV 2 r) (UnboundedConvexRegionF r NonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

(Point_ vertex 2 r, Point_ point 2 r, Ord r, Fractional r, IxValue (endPoint point) ~ point, EndPoint_ (endPoint point), HasOnSegment (LineSegment endPoint point) 2, HasIntersectionWith (ClosedLineSegment (Point 2 r)) (LineSegment endPoint point), HasIntersectionWith (HalfLine (Point 2 r)) (LineSegment endPoint point)) => HasIntersectionWith (LineSegment endPoint point) (UnboundedConvexRegionF r NonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

Methods

intersects :: LineSegment endPoint point -> UnboundedConvexRegionF r NonEmpty vertex -> Bool Source #

(Point_ vertex 2 r, Ord r, Fractional r) => HasIntersectionWith (Point 2 r) (UnboundedConvexRegionF r NonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

(Point_ vertex 2 r, Ord r, Fractional r) => IsIntersectableWith (LinePV 2 r) (UnboundedConvexRegionF r NonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

(NFData r, NFData (nonEmpty vertex)) => NFData (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

Methods

rnf :: UnboundedConvexRegionF r nonEmpty vertex -> () Source #

Generic (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

Associated Types

type Rep (UnboundedConvexRegionF r nonEmpty vertex) 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

type Rep (UnboundedConvexRegionF r nonEmpty vertex) = D1 ('MetaData "UnboundedConvexRegionF" "HGeometry.Polygon.Convex.Unbounded" "hgeometry-polygon-1.0.0.0-inplace" 'False) (C1 ('MetaCons "Unbounded" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector 2 r)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (nonEmpty vertex)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector 2 r)))))

Methods

from :: UnboundedConvexRegionF r nonEmpty vertex -> Rep (UnboundedConvexRegionF r nonEmpty vertex) x Source #

to :: Rep (UnboundedConvexRegionF r nonEmpty vertex) x -> UnboundedConvexRegionF r nonEmpty vertex Source #

(Show r, Show (nonEmpty vertex)) => Show (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

Methods

showsPrec :: Int -> UnboundedConvexRegionF r nonEmpty vertex -> ShowS Source #

show :: UnboundedConvexRegionF r nonEmpty vertex -> String Source #

showList :: [UnboundedConvexRegionF r nonEmpty vertex] -> ShowS Source #

(Eq r, Eq (nonEmpty vertex)) => Eq (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

Methods

(==) :: UnboundedConvexRegionF r nonEmpty vertex -> UnboundedConvexRegionF r nonEmpty vertex -> Bool Source #

(/=) :: UnboundedConvexRegionF r nonEmpty vertex -> UnboundedConvexRegionF r nonEmpty vertex -> Bool Source #

(Traversable1 nonEmpty, Ixed (nonEmpty vertex), IxValue (nonEmpty vertex) ~ vertex, Index (nonEmpty vertex) ~ Int) => HasVertices' (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

Associated Types

type Vertex (UnboundedConvexRegionF r nonEmpty vertex) 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

type Vertex (UnboundedConvexRegionF r nonEmpty vertex) = vertex
type VertexIx (UnboundedConvexRegionF r nonEmpty vertex) 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

type VertexIx (UnboundedConvexRegionF r nonEmpty vertex) = Int

Methods

vertexAt :: VertexIx (UnboundedConvexRegionF r nonEmpty vertex) -> IndexedTraversal' (VertexIx (UnboundedConvexRegionF r nonEmpty vertex)) (UnboundedConvexRegionF r nonEmpty vertex) (Vertex (UnboundedConvexRegionF r nonEmpty vertex)) Source #

numVertices :: UnboundedConvexRegionF r nonEmpty vertex -> Int Source #

(Traversable1 nonEmpty, Ixed (nonEmpty vertex), IxValue (nonEmpty vertex) ~ vertex, IxValue (nonEmpty vertex') ~ vertex', Index (nonEmpty vertex) ~ Int, Index (nonEmpty vertex') ~ Int) => HasVertices (UnboundedConvexRegionF r nonEmpty vertex) (UnboundedConvexRegionF r nonEmpty vertex') Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

Methods

vertices :: IndexedTraversal1 (VertexIx (UnboundedConvexRegionF r nonEmpty vertex)) (UnboundedConvexRegionF r nonEmpty vertex) (UnboundedConvexRegionF r nonEmpty vertex') (Vertex (UnboundedConvexRegionF r nonEmpty vertex)) (Vertex (UnboundedConvexRegionF r nonEmpty vertex')) Source #

type Intersection (Rectangle corner) (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

type Intersection (Rectangle corner) (UnboundedConvexRegionF r nonEmpty vertex) = Intersection (Rectangle corner) (ConvexPolygonF (Cyclic nonEmpty) vertex)
type Intersection (Triangle corner) (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

type Intersection (Triangle corner) (UnboundedConvexRegionF r nonEmpty vertex) = Intersection (Triangle corner) (ConvexPolygonF (Cyclic nonEmpty) vertex)
type Intersection (LinePV 2 r) (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

type Rep (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

type Rep (UnboundedConvexRegionF r nonEmpty vertex) = D1 ('MetaData "UnboundedConvexRegionF" "HGeometry.Polygon.Convex.Unbounded" "hgeometry-polygon-1.0.0.0-inplace" 'False) (C1 ('MetaCons "Unbounded" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector 2 r)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (nonEmpty vertex)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Vector 2 r)))))
type Dimension (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

type Dimension (UnboundedConvexRegionF r nonEmpty vertex) = 2
type NumType (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

type NumType (UnboundedConvexRegionF r nonEmpty vertex) = r
type Vertex (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

type Vertex (UnboundedConvexRegionF r nonEmpty vertex) = vertex
type VertexIx (UnboundedConvexRegionF r nonEmpty vertex) Source # 
Instance details

Defined in HGeometry.Polygon.Convex.Unbounded

type VertexIx (UnboundedConvexRegionF r nonEmpty vertex) = Int

chain :: forall r nonEmpty vertex nonEmpty' vertex' f. Functor f => (nonEmpty vertex -> f (nonEmpty' vertex')) -> UnboundedConvexRegionF r nonEmpty vertex -> f (UnboundedConvexRegionF r nonEmpty' vertex') Source #

Lens to access the chain of vertices in CCW order

extremalVertices :: UnboundedConvexRegionF r NonEmpty vertex -> Either vertex (Vector 2 vertex) Source #

Compute the first and last vertex of the chain. Returns a Left if the first and last are the same.

mapChain :: (nonEmpty vertex -> nonEmpty' vertex') -> UnboundedConvexRegionF r nonEmpty vertex -> UnboundedConvexRegionF r nonEmpty' vertex' Source #

map a function over the sequence of points

boundedCore :: forall (nonEmpty :: Type -> Type) vertex r. (VertexContainer nonEmpty vertex, Point_ vertex 2 r, HasFromFoldable1 nonEmpty) => UnboundedConvexRegionF r nonEmpty vertex -> PossiblyDegenerateSimplePolygon vertex (ConvexPolygonF (Cyclic nonEmpty) vertex) Source #

Computes the core of the unbounded region; i.e. the convex hull of the vertices of the region.

boundingRays :: (Point_ vertex 2 r, Num r) => UnboundedConvexRegionF r NonEmpty vertex -> Vector 2 (HalfLine vertex) Source #

Computes the two bounding rays of the unbounded region. Note that the rays now are both pointing toward infinity. The second ray has the unbounded region to its left, whereas the first one has it to its right.

unboundedBoundingHalfplanes :: (Point_ vertex 2 r, Num r, Ord r) => UnboundedConvexRegionF r NonEmpty vertex -> TwoOrThree (HalfPlaneF (LinePV 2 r)) Source #

the 2 or three halfplanes bounding the unbounded part of the region in particular: the region minus its bounded core

toBoundedFrom :: (Foldable nonEmpty, Point_ point 2 r, Point_ vertex 2 r, Ord r, Fractional r) => nonEmpty point -> UnboundedConvexRegionF r NonEmpty vertex -> ConvexPolygonF (Cyclic NonEmpty) vertex Source #

Given some convex shape S, construct some "big enough" convex polygon B out of the unbounded convex polygon U so that the intersection \(U \cap S\) is the same as (B cap S)

note: this creates some new vertices; which are "copies" from the extremal vertices. this is to avoid having to introduce yet another level of OriginalOrExtra's