diagrams-core-1.5.0: Core libraries for diagrams EDSL
Copyright(c) 2011 diagrams-core team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

Diagrams.Core.HasOrigin

Description

Types which have an intrinsic notion of a "local origin", i.e. things which are not invariant under translation.

Synopsis

Documentation

class HasOrigin t where Source #

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, Trails) are transformable but are translationally invariant, i.e. have no origin.

Methods

moveOriginTo :: Point (V t) (N t) -> t -> t Source #

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.

Instances

Instances details
HasOrigin t => HasOrigin [t] Source # 
Instance details

Defined in Diagrams.Core.HasOrigin

Methods

moveOriginTo :: Point (V [t]) (N [t]) -> [t] -> [t] Source #

(HasOrigin t, Ord t) => HasOrigin (Set t) Source # 
Instance details

Defined in Diagrams.Core.HasOrigin

Methods

moveOriginTo :: Point (V (Set t)) (N (Set t)) -> Set t -> Set t Source #

HasOrigin (TransInv t) Source # 
Instance details

Defined in Diagrams.Core.Transform

Methods

moveOriginTo :: Point (V (TransInv t)) (N (TransInv t)) -> TransInv t -> TransInv t Source #

(HasOrigin t, HasOrigin s, SameSpace s t) => HasOrigin (s, t) Source # 
Instance details

Defined in Diagrams.Core.HasOrigin

Methods

moveOriginTo :: Point (V (s, t)) (N (s, t)) -> (s, t) -> (s, t) Source #

HasOrigin t => HasOrigin (Map k t) Source # 
Instance details

Defined in Diagrams.Core.HasOrigin

Methods

moveOriginTo :: Point (V (Map k t)) (N (Map k t)) -> Map k t -> Map k t Source #

(Additive v, Num n) => HasOrigin (Point v n) Source # 
Instance details

Defined in Diagrams.Core.HasOrigin

Methods

moveOriginTo :: Point (V (Point v n)) (N (Point v n)) -> Point v n -> Point v n Source #

HasOrigin t => HasOrigin (Measured n t) Source # 
Instance details

Defined in Diagrams.Core.HasOrigin

Methods

moveOriginTo :: Point (V (Measured n t)) (N (Measured n t)) -> Measured n t -> Measured n t Source #

(Additive v, Num n) => HasOrigin (Transformation v n) Source # 
Instance details

Defined in Diagrams.Core.Transform

(Additive v, Num n) => HasOrigin (Trace v n) Source # 
Instance details

Defined in Diagrams.Core.Trace

Methods

moveOriginTo :: Point (V (Trace v n)) (N (Trace v n)) -> Trace v n -> Trace v n Source #

(Metric v, Fractional n) => HasOrigin (Envelope v n) Source #

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.

Instance details

Defined in Diagrams.Core.Envelope

Methods

moveOriginTo :: Point (V (Envelope v n)) (N (Envelope v n)) -> Envelope v n -> Envelope v n Source #

(Additive v, Num n) => HasOrigin (Query v n m) Source # 
Instance details

Defined in Diagrams.Core.Query

Methods

moveOriginTo :: Point (V (Query v n m)) (N (Query v n m)) -> Query v n m -> Query v n m Source #

(OrderedField n, Metric v) => HasOrigin (SubMap b v n m) Source # 
Instance details

Defined in Diagrams.Core.Types

Methods

moveOriginTo :: Point (V (SubMap b v n m)) (N (SubMap b v n m)) -> SubMap b v n m -> SubMap b v n m Source #

(Metric v, OrderedField n) => HasOrigin (Subdiagram b v n m) Source # 
Instance details

Defined in Diagrams.Core.Types

Methods

moveOriginTo :: Point (V (Subdiagram b v n m)) (N (Subdiagram b v n m)) -> Subdiagram b v n m -> Subdiagram b v n m Source #

(Metric v, OrderedField n, Semigroup m) => HasOrigin (QDiagram b v n m) Source #

Every diagram has an intrinsic "local origin" which is the basis for all combining operations.

Instance details

Defined in Diagrams.Core.Types

Methods

moveOriginTo :: Point (V (QDiagram b v n m)) (N (QDiagram b v n m)) -> QDiagram b v n m -> QDiagram b v n m Source #

moveOriginBy :: (V t ~ v, N t ~ n, HasOrigin t) => v n -> t -> t Source #

Move the local origin by a relative vector.

moveTo :: (InSpace v n t, HasOrigin t) => Point v n -> t -> t Source #

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
  

place :: (InSpace v n t, HasOrigin t) => t -> Point v n -> t Source #

A flipped variant of moveTo, provided for convenience. Useful when writing a function which takes a point as an argument, such as when using withName and friends.