| 1 |
module Diagrams.ThreeD.Deform |
| 2 |
( parallelX0, perspectiveX1, facingX |
| 3 |
, parallelY0, perspectiveY1, facingY |
| 4 |
, parallelZ0, perspectiveZ1, facingZ |
| 5 |
) where |
| 6 |
|
| 7 |
import Control.Lens |
| 8 |
|
| 9 |
import Diagrams.Deform |
| 10 |
import Diagrams.TwoD.Deform |
| 11 |
|
| 12 |
import Linear.V3 |
| 13 |
import Linear.Vector |
| 14 |
|
| 15 |
|
| 16 |
parallelZ0 :: (R3 v, Num n) => Deformation v v n |
| 17 |
parallelZ0 = Deformation (_z .~ 0) |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
perspectiveZ1 :: (R3 v, Functor v, Fractional n) => Deformation v v n |
| 22 |
perspectiveZ1 = Deformation $ \p -> p ^/ (p ^. _z) |
| 23 |
|
| 24 |
facingZ :: (R3 v, Functor v, Fractional n) => Deformation v v n |
| 25 |
facingZ = Deformation $ |
| 26 |
\p -> let z = p ^. _z |
| 27 |
in p ^/ z & _z .~ z |
| 28 |
|