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

Maintainer byorgey@cis.upenn.edu None

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 Typeable1 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)

unPoint :: Point v -> vSource

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)```.

The origin of the vector space `v`.

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

Scale a point by a scalar.

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

Reflect a point through the `origin`.

# Reflection through a point

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

Apply a transformation relative to the given point.

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

Apply a transformation relative to the given point.

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

Apply a transformation relative to the given point.

reflectThrough :: AffineSpace p => p -> p -> pSource

Mirror a point through a given point.