Copyright | (c) 2011 Brent Yorgey |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | byorgey@cis.upenn.edu |
Safe Haskell | None |
Language | Haskell2010 |
A type for points (as distinct from vectors), with an appropriate AffineSpace instance.
- newtype Point v = P v
- unPoint :: Point v -> v
- origin :: AdditiveGroup v => Point v
- (*.) :: VectorSpace v => Scalar v -> Point v -> Point v
- mirror :: AdditiveGroup v => Point v -> Point v
- relative :: AffineSpace p => p -> (Diff p -> Diff p) -> p -> p
- relative2 :: AffineSpace p => p -> (Diff p -> Diff p -> Diff p) -> p -> p -> p
- relative3 :: AffineSpace p => p -> (Diff p -> Diff p -> Diff p -> Diff p) -> p -> p -> p -> p
- reflectThrough :: AffineSpace p => p -> p -> p
Points
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.
P v |
origin :: AdditiveGroup v => Point v Source
The origin of the vector space v
.
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.