Copyright | (c) 2011 diagrams-lib team (see LICENSE) |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | diagrams-discuss@googlegroups.com |
Safe Haskell | Safe-Inferred |
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 :: Iso' (V2 n) (n, n)
- p2 :: (n, n) -> P2 n
- mkP2 :: n -> n -> P2 n
- unp2 :: P2 n -> (n, n)
- p2Iso :: Iso' (Point V2 n) (n, n)
- r2PolarIso :: RealFloat n => Iso' (V2 n) (n, Angle n)
- class HasR t 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 Source # foldMap :: Monoid m => (a -> m) -> V2 a -> m Source # foldMap' :: Monoid m => (a -> m) -> V2 a -> m Source # foldr :: (a -> b -> b) -> b -> V2 a -> b Source # foldr' :: (a -> b -> b) -> b -> V2 a -> b Source # foldl :: (b -> a -> b) -> b -> V2 a -> b Source # foldl' :: (b -> a -> b) -> b -> V2 a -> b Source # foldr1 :: (a -> a -> a) -> V2 a -> a Source # foldl1 :: (a -> a -> a) -> V2 a -> a Source # toList :: V2 a -> [a] Source # length :: V2 a -> Int Source # elem :: Eq a => a -> V2 a -> Bool Source # maximum :: Ord a => V2 a -> a Source # minimum :: Ord a => V2 a -> a Source # | |
Eq1 V2 | |
Ord1 V2 | |
Read1 V2 | |
Defined in Linear.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 | |
Defined in Linear.V2 | |
Apply V2 | |
Bind V2 | |
Foldable1 V2 | |
Traversable1 V2 | |
Num r => Coalgebra r (E V2) | |
Lift a => Lift (V2 a :: Type) | |
Unbox a => Vector Vector (V2 a) | |
Defined in Linear.V2 Methods basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V2 a) -> m (Vector (V2 a)) basicUnsafeThaw :: PrimMonad m => Vector (V2 a) -> m (Mutable Vector (PrimState m) (V2 a)) basicLength :: Vector (V2 a) -> Int basicUnsafeSlice :: Int -> Int -> Vector (V2 a) -> Vector (V2 a) basicUnsafeIndexM :: Monad m => Vector (V2 a) -> Int -> m (V2 a) basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V2 a) -> Vector (V2 a) -> m () | |
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 :: PrimMonad m => Int -> m (MVector (PrimState m) (V2 a)) basicInitialize :: PrimMonad m => MVector (PrimState m) (V2 a) -> m () basicUnsafeReplicate :: PrimMonad m => Int -> V2 a -> m (MVector (PrimState m) (V2 a)) basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> m (V2 a) basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> V2 a -> m () basicClear :: PrimMonad m => MVector (PrimState m) (V2 a) -> m () basicSet :: PrimMonad m => MVector (PrimState m) (V2 a) -> V2 a -> m () basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V2 a) -> MVector (PrimState m) (V2 a) -> m () basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V2 a) -> MVector (PrimState m) (V2 a) -> m () basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> m (MVector (PrimState m) (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) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V2 a) Source # toConstr :: V2 a -> Constr Source # dataTypeOf :: V2 a -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (V2 a)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V2 a)) Source # gmapT :: (forall b. Data b => b -> b) -> V2 a -> V2 a Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V2 a -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V2 a -> r Source # gmapQ :: (forall d. Data d => d -> u) -> V2 a -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> V2 a -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) Source # | |
Storable a => Storable (V2 a) | |
Defined in Linear.V2 Methods sizeOf :: V2 a -> Int Source # alignment :: V2 a -> Int Source # peekElemOff :: Ptr (V2 a) -> Int -> IO (V2 a) Source # pokeElemOff :: Ptr (V2 a) -> Int -> V2 a -> IO () Source # peekByteOff :: Ptr b -> Int -> IO (V2 a) Source # pokeByteOff :: Ptr b -> Int -> V2 a -> IO () Source # | |
Monoid a => Monoid (V2 a) | |
Semigroup a => Semigroup (V2 a) | |
Bounded a => Bounded (V2 a) | |
Floating a => Floating (V2 a) | |
Generic (V2 a) | |
Ix a => Ix (V2 a) | |
Defined in Linear.V2 | |
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) | |
Defined in Linear.V2 | |
Serialize a => Serialize (V2 a) | |
NFData a => NFData (V2 a) | |
Transformable (V2 n) Source # | |
Coordinates (V2 n) Source # | |
Defined in Diagrams.Coordinates | |
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) | |
Unbox a => Unbox (V2 a) | |
Defined in Linear.V2 | |
Generic1 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)) Source # | |
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)) Source # | |
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 | |
data MVector s (V2 a) | |
type Rep (V2 a) | |
Defined in Linear.V2 type Rep (V2 a) = D1 ('MetaData "V2" "Linear.V2" "linear-1.21.10-BWYLNa1VYXoLpBTdl1DQBL" '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) | |
type Rep1 V2 | |
Defined in Linear.V2 type Rep1 V2 = D1 ('MetaData "V2" "Linear.V2" "linear-1.21.10-BWYLNa1VYXoLpBTdl1DQBL" 'False) (C1 ('MetaCons "V2" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) Par1)) |
class R1 (t :: Type -> Type) where Source #
A space that has at least 1 basis vector _x
.
class R1 t => R2 (t :: Type -> Type) where Source #
Minimal complete definition
Methods
>>>
V2 1 2 ^._y
2
>>>
V2 1 2 & _y .~ 3
V2 1 3
type T2 = Transformation V2 Source #
A space which has magnitude _r
that can be calculated numerically.