vector-space-points-0.2.1.2: A type for points, as distinct from vectors.

Copyright(c) 2011 Brent Yorgey
LicenseBSD-style (see LICENSE)
Maintainerbyorgey@cis.upenn.edu
Safe HaskellSafe
LanguageHaskell2010

Data.AffineSpace.Point

Contents

Description

A type for points (as distinct from vectors), with an appropriate AffineSpace instance.

Synopsis

Points

newtype Point v #

Point is a newtype wrapper around vectors used to represent points, so we don't get them mixed up. The distinction between vectors and points is important: translations affect points, but leave vectors unchanged. Points are instances of the AffineSpace class from Data.AffineSpace.

Constructors

P v 

Instances

Functor Point # 

Methods

fmap :: (a -> b) -> Point a -> Point b #

(<$) :: a -> Point b -> Point a #

Eq v => Eq (Point v) # 

Methods

(==) :: Point v -> Point v -> Bool #

(/=) :: Point v -> Point v -> Bool #

Data v => Data (Point v) # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Point v -> c (Point v) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Point v) #

toConstr :: Point v -> Constr #

dataTypeOf :: Point v -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Point v)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Point v)) #

gmapT :: (forall b. Data b => b -> b) -> Point v -> Point v #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Point v -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Point v -> r #

gmapQ :: (forall d. Data d => d -> u) -> Point v -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Point v -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Point v -> m (Point v) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Point v -> m (Point v) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Point v -> m (Point v) #

Ord v => Ord (Point v) # 

Methods

compare :: Point v -> Point v -> Ordering #

(<) :: Point v -> Point v -> Bool #

(<=) :: Point v -> Point v -> Bool #

(>) :: Point v -> Point v -> Bool #

(>=) :: Point v -> Point v -> Bool #

max :: Point v -> Point v -> Point v #

min :: Point v -> Point v -> Point v #

Read v => Read (Point v) # 
Show v => Show (Point v) # 

Methods

showsPrec :: Int -> Point v -> ShowS #

show :: Point v -> String #

showList :: [Point v] -> ShowS #

AdditiveGroup v => AffineSpace (Point v) # 

Associated Types

type Diff (Point v) :: * #

Methods

(.-.) :: Point v -> Point v -> Diff (Point v) #

(.+^) :: Point v -> Diff (Point v) -> Point v #

type Diff (Point v) # 
type Diff (Point v) = v

unPoint :: Point v -> v #

Convert a point p into the vector from the origin to p. This should be considered a "semantically unsafe" operation; think carefully about whether and why you need to use it. The recommended way to do this conversion would be to write (p .-. origin).

origin :: AdditiveGroup v => Point v #

The origin of the vector space v.

(*.) :: VectorSpace v => Scalar v -> Point v -> Point v #

Scale a point by a scalar.

mirror :: AdditiveGroup v => Point v -> Point v #

Reflect a point through the origin.

Reflection through a point

relative :: AffineSpace p => p -> (Diff p -> Diff p) -> p -> p #

Apply a transformation relative to the given point.

relative2 :: AffineSpace p => p -> (Diff p -> Diff p -> Diff p) -> p -> p -> p #

Apply a transformation relative to the given point.

relative3 :: AffineSpace p => p -> (Diff p -> Diff p -> Diff p -> Diff p) -> p -> p -> p -> p #

Apply a transformation relative to the given point.

reflectThrough :: AffineSpace p => p -> p -> p #

Mirror a point through a given point.