Debian Codegraph @

src/Diagrams/ThreeD/Size.hs

raw symbols SCIP
1 {-# LANGUAGE ConstraintKinds #-}
2 {-# LANGUAGE FlexibleContexts #-}
3 {-# LANGUAGE TypeFamilies #-}
4
5 -----------------------------------------------------------------------------
6 -- |
7 -- Module : Diagrams.ThreeD.Size
8 -- Copyright : (c) 2014 diagrams-lib team (see LICENSE)
9 -- License : BSD-style (see LICENSE)
10 -- Maintainer : [email protected]
11 --
12 -- Utilities for working with sizes of three-dimensional objects.
13 --
14 -----------------------------------------------------------------------------
15 module Diagrams.ThreeD.Size
16 (
17 -- ** Computing sizes
18 extentX, extentY, extentZ
19
20 -- ** Specifying sizes
21 , mkSizeSpec3D
22 , dims3D
23
24 ) where
25
26 import Diagrams.Core
27 import Diagrams.Core.Envelope
28 import Diagrams.Size
29 import Diagrams.TwoD.Size
30 import Diagrams.ThreeD.Types
31 import Diagrams.ThreeD.Vector
32
33 ------------------------------------------------------------
34 -- Computing diagram sizes
35 ------------------------------------------------------------
36
37 -- | Compute the absolute z-coordinate range of an enveloped object in
38 -- the form @(lo,hi)@. Return @Nothing@ for objects with an empty
39 -- envelope.
40 extentZ :: (InSpace v n a, R3 v, Enveloped a) => a -> Maybe (n, n)
41 extentZ = extent unitZ
42
43 -- | Make a 'SizeSpec' from possibly-specified width and height.
44 mkSizeSpec3D :: Num n => Maybe n -> Maybe n -> Maybe n -> SizeSpec V3 n
45 mkSizeSpec3D x y z = mkSizeSpec (V3 x y z)
46
47 -- | Make a 'SizeSpec' from a width and height.
48 dims3D :: n -> n -> n -> SizeSpec V3 n
49 dims3D x y z = dims (V3 x y z)
50