Copyright | (c) 2011 diagrams-core team (see LICENSE) |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | diagrams-discuss@googlegroups.com |
Safe Haskell | None |
Language | Haskell2010 |
Types which have an intrinsic notion of a "local origin", i.e. things which are not invariant under translation.
Documentation
Class of types which have an intrinsic notion of a "local origin", i.e. things which are not invariant under translation, and which allow the origin to be moved.
One might wonder why not just use Transformable
instead of
having a separate class for HasOrigin
; indeed, for types which
are instances of both we should have the identity
moveOriginTo (origin .^+ v) === translate (negated v)
The reason is that some things (e.g. vectors, Trail
s) are
transformable but are translationally invariant, i.e. have no
origin.
moveOriginTo :: Point (V t) (N t) -> t -> t #
Move the local origin to another point.
Note that this function is in some sense dual to translate
(for types which are also Transformable
); moving the origin
itself while leaving the object "fixed" is dual to fixing the
origin and translating the diagram.
HasOrigin t => HasOrigin [t] # | |
(HasOrigin t, Ord t) => HasOrigin (Set t) # | |
HasOrigin (TransInv t) # | |
(HasOrigin t, HasOrigin s, SameSpace s t) => HasOrigin (s, t) # | |
HasOrigin t => HasOrigin (Map k t) # | |
(Additive v, Num n) => HasOrigin (Point v n) # | |
HasOrigin t => HasOrigin (Measured n t) # | |
(Additive v, Num n) => HasOrigin (Transformation v n) # | |
(Additive v, Num n) => HasOrigin (Trace v n) # | |
(Metric v, Fractional n) => HasOrigin (Envelope v n) # | The local origin of an envelope is the point with respect to which bounding queries are made, i.e. the point from which the input vectors are taken to originate. |
(Additive v, Num n) => HasOrigin (Query v n m) # | |
(OrderedField n, Metric v) => HasOrigin (SubMap b v n m) # | |
(Metric v, OrderedField n) => HasOrigin (Subdiagram b v n m) # | |
(Metric v, OrderedField n, Semigroup m) => HasOrigin (QDiagram b v n m) # | Every diagram has an intrinsic "local origin" which is the basis for all combining operations. |
moveOriginBy :: (V t ~ v, N t ~ n, HasOrigin t) => v n -> t -> t #
Move the local origin by a relative vector.
moveTo :: (InSpace v n t, HasOrigin t) => Point v n -> t -> t #
Translate the object by the translation that sends the origin to
the given point. Note that this is dual to moveOriginTo
, i.e. we
should have
moveTo (origin .^+ v) === moveOriginTo (origin .^- v)
For types which are also Transformable
, this is essentially the
same as translate
, i.e.
moveTo (origin .^+ v) === translate v