Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
66da322
It compiles without vector-space.
cchalmers Aug 18, 2014
34cfadd
Added some more exports.
cchalmers Aug 18, 2014
2112fb0
More adjustments.
cchalmers Aug 22, 2014
68ce616
Use signorm instead of normalize. (no Epsilon n)
cchalmers Aug 24, 2014
675cab4
New number classes.
cchalmers Aug 24, 2014
1600fb2
Fixed bug in render type signature.
cchalmers Aug 25, 2014
9e86df7
Use stylish-haskell config.
cchalmers Aug 31, 2014
8183e8f
Changes to Measure including scaleLocal function.
cchalmers Sep 2, 2014
8ab3b47
Add size function.
cchalmers Sep 3, 2014
76f3367
Fixes from comments.
cchalmers Sep 7, 2014
f8844f1
Merge branch 'master' into linear
bergey Sep 12, 2014
36acc14
Remove Additive instance for Measure.
cchalmers Sep 14, 2014
95946cc
Remove unnessessary HasLinearMap constraints and add HasBasis class.
cchalmers Sep 14, 2014
5effb28
Remove derived Data instance for Point.
cchalmers Sep 14, 2014
4d6b181
Remove derived Typeable instance for Point.
cchalmers Sep 14, 2014
76f4b85
Remove Vn a ~ v n syntax.
cchalmers Sep 15, 2014
925f332
Remove Vn a ~ Vn b syntax.
cchalmers Sep 15, 2014
6abd23e
Forgot to save Transform.hs.
cchalmers Sep 15, 2014
1c97c6a
Remove Typeable instance for QDiagram.
cchalmers Sep 15, 2014
b021c58
Do Typeable1 v for ghc < 707.
cchalmers Sep 15, 2014
17b4e73
Missed one.
cchalmers Sep 15, 2014
d78141f
Merge branch 'master' into linear
jeffreyrosenbluth Sep 19, 2014
7d39b1d
Add Typeable instance for QDiagram.
cchalmers Sep 20, 2014
9984e7a
Merge branch 'linear' of https://github.com/diagrams/diagrams-core in…
cchalmers Sep 20, 2014
9baef01
fix type in comments
bergey Oct 4, 2014
7d96bba
cabal: conservative upper bound on linear
bergey Oct 6, 2014
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add size function.
  • Loading branch information
cchalmers committed Sep 3, 2014
commit 8ab3b473d01cde347cee114d66e2c99b50ffa39f
2 changes: 1 addition & 1 deletion src/Diagrams/Core.hs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ module Diagrams.Core
, appEnvelope, onEnvelope, mkEnvelope
, Enveloped(..)
, envelopeVMay, envelopeV, envelopePMay, envelopeP
, diameter, radius
, diameter, radius, size

-- * Traces

Expand Down
7 changes: 6 additions & 1 deletion src/Diagrams/Core/Envelope.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module Diagrams.Core.Envelope
, diameter
, radius
, extent
, size
, envelopeVMay, envelopeV, envelopePMay, envelopeP, envelopeSMay, envelopeS

-- * Miscellaneous
Expand All @@ -50,6 +51,7 @@ import qualified Data.Map as M
import Data.Maybe (fromMaybe)
import Data.Semigroup
import qualified Data.Set as S
import Data.Functor.Rep

import Diagrams.Core.HasOrigin
import Diagrams.Core.Points
Expand Down Expand Up @@ -130,7 +132,6 @@ deriving instance Ord n => Semigroup (Envelope v n)
deriving instance Ord n => Monoid (Envelope v n)



-- XXX add some diagrams here to illustrate! Note that Haddock supports
-- inline images, using a \<\<url\>\> syntax.

Expand Down Expand Up @@ -268,3 +269,7 @@ radius v = (0.5*) . diameter v
extent :: (Vn a ~ v n, Enveloped a) => v n -> a -> Maybe (n, n)
extent v a = (\f -> (-f (negated v), f v)) <$> (appEnvelope . getEnvelope $ a)

-- | Compute the size of an enveloped object as a vector.
size :: (Vn a ~ v n, Enveloped a, HasLinearMap v) => a -> v n
size d = tabulate $ \(E l) -> diameter (unit l) d