packages feed

diagrams-lib-1.4.2 / src / Diagrams / ThreeD / Deform.hs

module Diagrams.ThreeD.Deform  ( parallelX0, perspectiveX1, facingX  , parallelY0, perspectiveY1, facingY  , parallelZ0, perspectiveZ1, facingZ  ) whereimport           Control.Lensimport           Diagrams.Deformimport           Diagrams.TwoD.Deformimport           Linear.V3import           Linear.Vector-- | The parallel projection onto the plane z=0parallelZ0 :: (R3 v, Num n) => Deformation v v nparallelZ0 = Deformation (_z .~ 0)-- | The perspective division onto the plane z=1 along lines going--   through the origin.perspectiveZ1 :: (R3 v, Functor v, Fractional n) => Deformation v v nperspectiveZ1 = Deformation $ \p -> p ^/ (p ^. _x)facingZ :: (R3 v, Functor v, Fractional n) => Deformation v v nfacingZ = Deformation $  \p -> let z = p ^. _z        in  p ^/ z & _z .~ z