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

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

Data.AffineSpace.Point

Contents

Description

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

Synopsis

Points

newtype Point v Source

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 
Eq v => Eq (Point v) 
Data v => Data (Point v) 
Ord v => Ord (Point v) 
Read v => Read (Point v) 
Show v => Show (Point v) 
AdditiveGroup v => AffineSpace (Point v) 
Typeable (* -> *) Point 
type Diff (Point v) = v 

unPoint :: Point v -> v Source

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 Source

The origin of the vector space v.

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

Scale a point by a scalar.

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

Reflect a point through the origin.

Reflection through a point

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

Apply a transformation relative to the given point.

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

Apply a transformation relative to the given point.

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

Apply a transformation relative to the given point.

reflectThrough :: AffineSpace p => p -> p -> p Source

Mirror a point through a given point.