Copyright | (c) 2011 diagrams-lib team (see LICENSE) |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | diagrams-discuss@googlegroups.com |
Safe Haskell | None |
Language | Haskell2010 |
Diagrams.TwoD.Types
Description
Basic types for two-dimensional Euclidean space.
Synopsis
- data V2 a = V2 !a !a
- class R1 (t :: Type -> Type) where
- class R1 t => R2 (t :: Type -> Type) where
- type P2 = Point V2
- type T2 = Transformation V2
- r2 :: (n, n) -> V2 n
- unr2 :: V2 n -> (n, n)
- mkR2 :: n -> n -> V2 n
- r2Iso :: forall n p f. (Profunctor p, Functor f) => p (n, n) (f (n, n)) -> p (V2 n) (f (V2 n))
- p2 :: (n, n) -> P2 n
- mkP2 :: n -> n -> P2 n
- unp2 :: P2 n -> (n, n)
- p2Iso :: forall n p f. (Profunctor p, Functor f) => p (n, n) (f (n, n)) -> p (Point V2 n) (f (Point V2 n))
- r2PolarIso :: RealFloat n => Iso' (V2 n) (n, Angle n)
- class HasR (t :: Type -> Type) where
2D Euclidean space
A 2-dimensional vector
>>>
pure 1 :: V2 Int
V2 1 1
>>>
V2 1 2 + V2 3 4
V2 4 6
>>>
V2 1 2 * V2 3 4
V2 3 8
>>>
sum (V2 1 2)
3
Constructors
V2 !a !a |
Instances
Representable V2 | |||||||||||||
MonadFix V2 | |||||||||||||
MonadZip V2 | |||||||||||||
Foldable V2 | |||||||||||||
Defined in Linear.V2 Methods fold :: Monoid m => V2 m -> m # foldMap :: Monoid m => (a -> m) -> V2 a -> m # foldMap' :: Monoid m => (a -> m) -> V2 a -> m # foldr :: (a -> b -> b) -> b -> V2 a -> b # foldr' :: (a -> b -> b) -> b -> V2 a -> b # foldl :: (b -> a -> b) -> b -> V2 a -> b # foldl' :: (b -> a -> b) -> b -> V2 a -> b # foldr1 :: (a -> a -> a) -> V2 a -> a # foldl1 :: (a -> a -> a) -> V2 a -> a # elem :: Eq a => a -> V2 a -> Bool # maximum :: Ord a => V2 a -> a # | |||||||||||||
Foldable1 V2 | |||||||||||||
Defined in Linear.V2 Methods fold1 :: Semigroup m => V2 m -> m # foldMap1 :: Semigroup m => (a -> m) -> V2 a -> m # foldMap1' :: Semigroup m => (a -> m) -> V2 a -> m # toNonEmpty :: V2 a -> NonEmpty a # maximum :: Ord a => V2 a -> a # minimum :: Ord a => V2 a -> a # foldrMap1 :: (a -> b) -> (a -> b -> b) -> V2 a -> b # foldlMap1' :: (a -> b) -> (b -> a -> b) -> V2 a -> b # foldlMap1 :: (a -> b) -> (b -> a -> b) -> V2 a -> b # foldrMap1' :: (a -> b) -> (a -> b -> b) -> V2 a -> b # | |||||||||||||
Eq1 V2 | |||||||||||||
Ord1 V2 | |||||||||||||
Read1 V2 | |||||||||||||
Show1 V2 | |||||||||||||
Traversable V2 | |||||||||||||
Applicative V2 | |||||||||||||
Functor V2 | |||||||||||||
Monad V2 | |||||||||||||
Serial1 V2 | |||||||||||||
Defined in Linear.V2 Methods serializeWith :: MonadPut m => (a -> m ()) -> V2 a -> m () # deserializeWith :: MonadGet m => m a -> m (V2 a) # | |||||||||||||
HasTheta V2 Source # | |||||||||||||
HasR V2 Source # | |||||||||||||
Distributive V2 | |||||||||||||
Hashable1 V2 | |||||||||||||
Affine V2 | |||||||||||||
Metric V2 | |||||||||||||
Trace V2 | |||||||||||||
Finite V2 | |||||||||||||
R1 V2 | |||||||||||||
R2 V2 | |||||||||||||
Additive V2 | |||||||||||||
Apply V2 | |||||||||||||
Bind V2 | |||||||||||||
Traversable1 V2 | |||||||||||||
Generic1 V2 | |||||||||||||
Defined in Linear.V2 Associated Types
| |||||||||||||
Num r => Coalgebra r (E V2) | |||||||||||||
Lift a => Lift (V2 a :: Type) | |||||||||||||
Unbox a => Vector Vector (V2 a) | |||||||||||||
Defined in Linear.V2 Methods basicUnsafeFreeze :: Mutable Vector s (V2 a) -> ST s (Vector (V2 a)) basicUnsafeThaw :: Vector (V2 a) -> ST s (Mutable Vector s (V2 a)) basicLength :: Vector (V2 a) -> Int basicUnsafeSlice :: Int -> Int -> Vector (V2 a) -> Vector (V2 a) basicUnsafeIndexM :: Vector (V2 a) -> Int -> Box (V2 a) basicUnsafeCopy :: Mutable Vector s (V2 a) -> Vector (V2 a) -> ST s () | |||||||||||||
Unbox a => MVector MVector (V2 a) | |||||||||||||
Defined in Linear.V2 Methods basicLength :: MVector s (V2 a) -> Int basicUnsafeSlice :: Int -> Int -> MVector s (V2 a) -> MVector s (V2 a) basicOverlaps :: MVector s (V2 a) -> MVector s (V2 a) -> Bool basicUnsafeNew :: Int -> ST s (MVector s (V2 a)) basicInitialize :: MVector s (V2 a) -> ST s () basicUnsafeReplicate :: Int -> V2 a -> ST s (MVector s (V2 a)) basicUnsafeRead :: MVector s (V2 a) -> Int -> ST s (V2 a) basicUnsafeWrite :: MVector s (V2 a) -> Int -> V2 a -> ST s () basicClear :: MVector s (V2 a) -> ST s () basicSet :: MVector s (V2 a) -> V2 a -> ST s () basicUnsafeCopy :: MVector s (V2 a) -> MVector s (V2 a) -> ST s () basicUnsafeMove :: MVector s (V2 a) -> MVector s (V2 a) -> ST s () basicUnsafeGrow :: MVector s (V2 a) -> Int -> ST s (MVector s (V2 a)) | |||||||||||||
Data a => Data (V2 a) | |||||||||||||
Defined in Linear.V2 Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V2 a -> c (V2 a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V2 a) # dataTypeOf :: V2 a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (V2 a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V2 a)) # gmapT :: (forall b. Data b => b -> b) -> V2 a -> V2 a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V2 a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V2 a -> r # gmapQ :: (forall d. Data d => d -> u) -> V2 a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> V2 a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) # | |||||||||||||
Storable a => Storable (V2 a) | |||||||||||||
Monoid a => Monoid (V2 a) | |||||||||||||
Semigroup a => Semigroup (V2 a) | |||||||||||||
Bounded a => Bounded (V2 a) | |||||||||||||
Floating a => Floating (V2 a) | |||||||||||||
Generic (V2 a) | |||||||||||||
Defined in Linear.V2 Associated Types
| |||||||||||||
Ix a => Ix (V2 a) | |||||||||||||
Num a => Num (V2 a) | |||||||||||||
Read a => Read (V2 a) | |||||||||||||
Fractional a => Fractional (V2 a) | |||||||||||||
Show a => Show (V2 a) | |||||||||||||
Binary a => Binary (V2 a) | |||||||||||||
Serial a => Serial (V2 a) | |||||||||||||
Serialize a => Serialize (V2 a) | |||||||||||||
NFData a => NFData (V2 a) | |||||||||||||
Transformable (V2 n) Source # | |||||||||||||
Defined in Diagrams.TwoD.Types | |||||||||||||
Coordinates (V2 n) Source # | |||||||||||||
Defined in Diagrams.Coordinates Associated Types
| |||||||||||||
Eq a => Eq (V2 a) | |||||||||||||
Ord a => Ord (V2 a) | |||||||||||||
Hashable a => Hashable (V2 a) | |||||||||||||
Ixed (V2 a) | |||||||||||||
Epsilon a => Epsilon (V2 a) | |||||||||||||
Random a => Random (V2 a) | |||||||||||||
Uniform a => Uniform (V2 a) | |||||||||||||
Defined in Linear.V2 Methods uniformM :: StatefulGen g m => g -> m (V2 a) # | |||||||||||||
UniformRange a => UniformRange (V2 a) | |||||||||||||
Unbox a => Unbox (V2 a) | |||||||||||||
Defined in Linear.V2 | |||||||||||||
RealFloat n => HasQuery (Located (Trail V2 n)) Crossings Source # | |||||||||||||
RealFloat n => HasQuery (Located (Trail' l V2 n)) Crossings Source # | |||||||||||||
FoldableWithIndex (E V2) V2 | |||||||||||||
FunctorWithIndex (E V2) V2 | |||||||||||||
TraversableWithIndex (E V2) V2 | |||||||||||||
Each (V2 a) (V2 b) a b | |||||||||||||
Field1 (V2 a) (V2 a) a a | |||||||||||||
Field2 (V2 a) (V2 a) a a | |||||||||||||
RealFloat n => Traced (BoundingBox V2 n) Source # | |||||||||||||
Defined in Diagrams.BoundingBox Methods getTrace :: BoundingBox V2 n -> Trace (V (BoundingBox V2 n)) (N (BoundingBox V2 n)) # | |||||||||||||
RealFloat n => Traced (Path V2 n) Source # | |||||||||||||
OrderedField n => Traced (FixedSegment V2 n) Source # | |||||||||||||
Defined in Diagrams.TwoD.Segment Methods getTrace :: FixedSegment V2 n -> Trace (V (FixedSegment V2 n)) (N (FixedSegment V2 n)) # | |||||||||||||
RealFloat n => Traced (Trail V2 n) Source # | |||||||||||||
RealFloat n => HasQuery (Path V2 n) Crossings Source # | |||||||||||||
OrderedField n => Traced (Segment Closed V2 n) Source # | |||||||||||||
(TypeableFloat n, Renderable (Path V2 n) b) => TrailLike (QDiagram b V2 n Any) Source # | |||||||||||||
type Rep V2 | |||||||||||||
type Diff V2 | |||||||||||||
Defined in Linear.Affine | |||||||||||||
type Size V2 | |||||||||||||
type Rep1 V2 | |||||||||||||
Defined in Linear.V2 type Rep1 V2 = D1 ('MetaData "V2" "Linear.V2" "linear-1.23.2-DpgMnhOw1WnCVLrcyVjH04" 'False) (C1 ('MetaCons "V2" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1)) | |||||||||||||
data MVector s (V2 a) | |||||||||||||
type Rep (V2 a) | |||||||||||||
Defined in Linear.V2 type Rep (V2 a) = D1 ('MetaData "V2" "Linear.V2" "linear-1.23.2-DpgMnhOw1WnCVLrcyVjH04" 'False) (C1 ('MetaCons "V2" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 a))) | |||||||||||||
type N (V2 n) Source # | |||||||||||||
Defined in Diagrams.TwoD.Types | |||||||||||||
type V (V2 n) Source # | |||||||||||||
Defined in Diagrams.TwoD.Types | |||||||||||||
type Decomposition (V2 n) Source # | |||||||||||||
Defined in Diagrams.Coordinates | |||||||||||||
type FinalCoord (V2 n) Source # | |||||||||||||
Defined in Diagrams.Coordinates | |||||||||||||
type PrevDim (V2 n) Source # | |||||||||||||
Defined in Diagrams.Coordinates | |||||||||||||
type Index (V2 a) | |||||||||||||
type IxValue (V2 a) | |||||||||||||
data Vector (V2 a) | |||||||||||||
class R1 (t :: Type -> Type) where #
A space that has at least 1 basis vector _x
.
class R1 t => R2 (t :: Type -> Type) where #
Minimal complete definition
Methods
>>>
V2 1 2 ^._y
2
>>>
V2 1 2 & _y .~ 3
V2 1 3
type T2 = Transformation V2 Source #
r2Iso :: forall n p f. (Profunctor p, Functor f) => p (n, n) (f (n, n)) -> p (V2 n) (f (V2 n)) Source #
p2Iso :: forall n p f. (Profunctor p, Functor f) => p (n, n) (f (n, n)) -> p (Point V2 n) (f (Point V2 n)) Source #
class HasR (t :: Type -> Type) where Source #
A space which has magnitude _r
that can be calculated numerically.