diagrams-lib-1.4.2.3: Embedded domain-specific language for declarative graphics

Copyright (c) 2014 diagrams-lib team (see LICENSE) BSD-style (see LICENSE) diagrams-discuss@googlegroups.com None Haskell2010

Diagrams.Direction

Description

Type for representing directions, polymorphic in vector space

Synopsis

# Documentation

data Direction v n #

A vector is described by a Direction and a magnitude. So we can think of a Direction as a vector that has forgotten its magnitude. Directions can be used with fromDirection and the lenses provided by its instances.

Instances
 Functor v => Functor (Direction v) # Instance detailsDefined in Diagrams.Direction Methodsfmap :: (a -> b) -> Direction v a -> Direction v b #(<\$) :: a -> Direction v b -> Direction v a # HasPhi v => HasPhi (Direction v) # Instance detailsDefined in Diagrams.Direction Methods_phi :: RealFloat n => Lens' (Direction v n) (Angle n) # HasTheta v => HasTheta (Direction v) # Instance detailsDefined in Diagrams.Direction Methods_theta :: RealFloat n => Lens' (Direction v n) (Angle n) # Eq (v n) => Eq (Direction v n) # Instance detailsDefined in Diagrams.Direction Methods(==) :: Direction v n -> Direction v n -> Bool #(/=) :: Direction v n -> Direction v n -> Bool # Ord (v n) => Ord (Direction v n) # Instance detailsDefined in Diagrams.Direction Methodscompare :: Direction v n -> Direction v n -> Ordering #(<) :: Direction v n -> Direction v n -> Bool #(<=) :: Direction v n -> Direction v n -> Bool #(>) :: Direction v n -> Direction v n -> Bool #(>=) :: Direction v n -> Direction v n -> Bool #max :: Direction v n -> Direction v n -> Direction v n #min :: Direction v n -> Direction v n -> Direction v n # Read (v n) => Read (Direction v n) # Instance detailsDefined in Diagrams.Direction MethodsreadsPrec :: Int -> ReadS (Direction v n) #readList :: ReadS [Direction v n] #readPrec :: ReadPrec (Direction v n) # Show (v n) => Show (Direction v n) # Instance detailsDefined in Diagrams.Direction MethodsshowsPrec :: Int -> Direction v n -> ShowS #show :: Direction v n -> String #showList :: [Direction v n] -> ShowS # (V (v n) ~ v, N (v n) ~ n, Transformable (v n)) => Transformable (Direction v n) # Instance detailsDefined in Diagrams.Direction Methodstransform :: Transformation (V (Direction v n)) (N (Direction v n)) -> Direction v n -> Direction v n # type V (Direction v n) # Instance detailsDefined in Diagrams.Direction type V (Direction v n) = v type N (Direction v n) # Instance detailsDefined in Diagrams.Direction type N (Direction v n) = n

_Dir :: Iso' (Direction v n) (v n) #

_Dir is provided to allow efficient implementations of functions in particular vector-spaces, but should be used with care as it exposes too much information.

direction :: v n -> Direction v n #

direction v is the direction in which v points. Returns an unspecified value when given the zero vector as input.

dir :: v n -> Direction v n #

Synonym for direction.

fromDirection :: (Metric v, Floating n) => Direction v n -> v n #

fromDirection d is the unit vector in the direction d.

fromDir :: (Metric v, Floating n) => Direction v n -> v n #

Synonym for fromDirection.

angleBetweenDirs :: (Metric v, Floating n, Ord n) => Direction v n -> Direction v n -> Angle n #

compute the positive angle between the two directions in their common plane

dirBetween :: (Additive v, Num n) => Point v n -> Point v n -> Direction v n #

dirBetween p q returns the direction from p to q.