Changelog for diagramslib1.0
1.0 (25 November 2013)

New features
 New modules
Diagrams.TwoD.Arrow
andDiagrams.TwoD.Arrowheads
for creating arrows.  New module
Diagrams.Backend.CmdLine
, providing a flexible framework for creating commandlinedriven diagram rendering executables.  New functions in
Diagrams.Offset
:offsetTrail
andoffsetPath
for onesided offsets of trails and paths;expandTrail
andexpandPath
for "stroking" trails and paths, computing a path whose fill corresponds to the stroke of the given trail or path.  New module
Diagrams.Tangent
for computing tangent and normal vectors of segments, trails, and paths.  New functions in
Diagrams.Align
to allow diagrams to be aligned byTrace
calledsnug
,snugBy
andsnugCenter
and the ability to define other boundary functions for alignment. FunctionssnugL
,snugR
, etc. are included inTwoD.Align
.  Lenses from
Control.Lens
are now used consistently for record fields throughout the library.  New function
angleRatio
for calculating the ratio between two angles.  Restricted identity functions
asTurn
,asRad
, andasDeg
for resolving type ambiguity  New miter limit attribute.
 New function
annularWedge
inTwoD.Arc
 New
avgScale
utility inTwoD.Transform
, for backends which cannot fully implement freezing of line width  New function
heptagon
, a vast improvement over the linguistic frankensteinseptagon
.  New function
lookupName
(reexported fromdiagramscore
) for simple lookups of named subdiagrams  New function
angleBetween
to calculate the angle between two vectors.  New function
arcBetween
to draw an arc between two given points.  A bunch of new modules containing types, primitives and
utilities for constructing 3D diagrams:
Diagrams.ThreeD.Align
,.Camera
,.Light
,.Shapes
,.Transform
,.Types
, and.Vector
. This is still a "feature preview" (in particular, appropriate 3D backends are still under construction).
 New modules

New instances
AdditiveGroup
andVectorSpace
instances forTurn
,Rad
,Deg
Alignable
instance for(>) e
Default
instances forFillRule
,FillRuleA
,LineJoin
,LineCap
,FillColor
Show
instances forFillRule
,FillRuleA

API changes
e
no longer exported fromDiagrams.Prelude
.Diagrams.BoundingBox
is no longer exported fromDiagrams.Prelude
. Reexport
Diagrams.Core.pointDiagram
fromDiagrams.Prelude
.  Added
fromAlphaColour
method toColor
class. &
renamed to^&
 Stop reexporting
tan
,over
, andboth
fromData.Colour
.  New coordinate lenses
_x
,_y
, and_z
forR2
,P2
,R3
,P3
 Export
fullTurn
fromDiagrams.Prelude
. Codomain (Located a)
is nowPoint (Codomain a)
instead ofLocated (Codomain a)
. Export
domainBounds
fromDiagrams.Parametric
.  Adjusting functionality moved from
Diagrams.Parametric
to its own module,Diagrams.Parametric.Adjust
.  Rename
strokeT
(and primed variant) tostrokeTrail
; renamestrokeLocT
tostrokeLocTrail
. ScaleInv
is now in its own module,Diagrams.TwoD.Transform.ScaleInv
. Reexport
Image
type (but not constructor) fromDiagrams.TwoD
 Removed
Floating
andRealFloat
instances forTurn
andDeg
offsetSegment
now returns aLocated
instead of a tuple. Removed
Num
andFractional
instances forR2
.

Dependency/version changes
 Remove
newtype
dependency  New dependencies on
lens
,tagged
,optparseapplicative
,filepath
,safe
,vectorspacepoints
,MemoTrie
 Depend on
intervals >= 0.3 && < 0.5
.
 Remove

Bug fixes

Depend on
intervals 0.3
, which allows diagrams to build on Windows, by evading a GHCi linker bug which affects the FFI use in previous versions of intervals (diagramscontrib#14) 
Use point envelope at the origin for text objects instead of an empty envelope (#115, #116).

Adjusting the end of a trail now works correctly (#95).

Only look for miter join on corners in
Diagrams.TwoD.Offset
(#118). 
wedge
fromDiagrams.TwoD.Arc
is now a Loop (#99)


Performance improvements
R2
is now strict andUNPACK
ed Add strictness to
Offset
,Segment
,OffsetEnvelope
, andSizeSpec2D
.  Make
getEnvelope
calculation forSegment
more efficient by floating divisions out of the inner calculation.  Use a specialized
HasTrie
instance forR2
.
0.7.1.1 (27 September 2013)
 allow semigroups0.11
0.7.1 (11 September 2013)

New features
 New standard miter limit attribute
 New functions
lineColorA
,lineWidthA
,lineMiterLimitA
,fontSizeA
for directly applying attribute values setDefault2DAttributes
now sets default line cap (butt), line join (miter), and miter limit (10) attributes

New instances
Data.Default
instances forLineCap
LineJoin
LineMiterLimit
LineWidth
LineColor
FontSize
0.7 (9 August 2013)

New features
 New module
Diagrams.TwoD.Curvature
, for computing the curvature of 2D segments at any given point.  New module
Diagrams.Offset
, containing anoffsetSegment
function that builds a trail a fixed distance from the original segment. This is a precursor to planned functionsoffsetTrail
andoffsetPath
.  New function
Diagrams.TwoD.Transform.onBasis
, for extracting a matrix representation of a 2D transformation  New functions
extrudeEnvelope
andintrudeEnvelope
, for extending or shrinking an envelope only in a certain direction.  Generalize the
Color
class to absolute colors. This addresses concerns raised in issue #66 by letting the backend choose which color space to renderColor
instances to. Functions are provided for backwards compatibility with the old semantics.  New function
scaleInvPrim
for creating a diagram from a single scaleinvariant primitive.  New module
Diagrams.Parametric
, containing a collection of classes abstracting over "parametric" things:Parametric
,DomainBounds
,EndValues
,Sectionable
, andHasArcLength
, with instances for segments, trails, and related things.  A big refactoring of segments and trails:
 Segments can now be either "closed" or "open".
 There are now two types of trails: "lines" (which travel
from point A to point B) or "loops" (closed curves which end
where they started).
Trail
is now a wrapper type which can contain both loops and lines.  There is a new
Located
wrapper type for adding locations to translationinvariant things.Path
s now consist of a collection ofLocated Trail
s.  The
PathLike
class is now renamed toTrailLike
; thetrailLike
function takes aLocated Trail
as input.
 New convenience functions
boundaryFrom
andboundaryFromMay
, for computing boundaries of subdiagrams.  Reexport from
diagramslib
a lot of things defined indiagramscore
, to make them easier for users to find. Several new modules have been created as a result:Diagrams.Query
,Diagrams.Envelope
,Diagrams.Trace
, andDiagrams.Names
.  Export the
centroid
function fromDiagrams.Prelude
. triangle
is now a synonym foreqTriangle
.
 New module

New instances
IsPrim
instances forPath
,Ellipsoid
,Image
,Text
, andScaleInv
Eq
,Ord
, andShow
instances forSizeSpec2D

API changes
CircleFrac
has been renamedTurn
(thoughCircleFrac
is retained as a deprecated synonym).Diagrams.Coordinates
is no longer exported fromDiagrams.Prelude
. This is for compatibility withlens
, as(&)
is a rather important lens operator and clashes withDiagrams.Coordinates
. Users who want theCoordinates
stuff can importDiagrams.Coordinates
explicitly.

Dependency/version changes
 allow
base4.7
 upgrade to
monoidextras0.3
 depend on
datadefaultclass
instead ofdatadefault
 Tested with GHC 7.7.
 allow

Bug fixes
 Added a special case that was a not handled properly by the quadratic solver, resulting in bogus envelopes in certain cases (#88).
 Import only
Data.NumInstances.Tuple
instead ofData.NumInstances
. Previously,Diagrams.Prelude
exportedEq
,Show
, andNum
instances for functions and tuples; now it only exports tuple instances. Users wishing to useDiagrams.CubicSpline
with a vector space built over functions (!?) can importData.NumInstances.Function
themselves. (#48)  Do scaling on a
Path
before constructing aTrailLike
inrect
(#43)
0.6.0.3 (4 May 2013)
 bump upper bound to allow
NumInstances1.3
0.6.0.2 (28 March 2013)

bump upper bound to allow
NumInstances1.2

Quadratic solver is now more numerically stable, getting rid of some incorrect behavior of
juxtapose
(#46)
0.6.0.1: 7 January 2013
 allow
semigroups0.9
0.6: 11 December 2012

New features

boundingRect
function for constructing a bounding rectangle 
bg
function for "setting the background color" (i.e. placing atop a colored bounding rectangle) 
New functions
setDefault2DAttributes
andadjustDiaSize2D
.adjustDia2D
does both  so the behavior ofadjustDia2D
has not changed, but it is now possible to apply just one of the two adjustments using the new functions. 
Diagrams.TwoD.Transform
now exports aScaleInv
type for creating scaleinvariant objects, which are only affected by rotational and translational components of transformations. 
The new
Diagrams.Coordinates
module provides nicer syntax for constructing and patternmatching point and vector literals. 
New
fromFixedSeg
function inDiagrams.Segment
, which decomposes aFixedSegment
into a starting point and aSegment
. 
New
withTrace
function for setting theTrace
of a diagram. 
Three new sizerelated functions:

New
sized
function for scaling an object to a particular size. One particularly nice use of this is to obviate the need to keep fiddling with the line width to get diagrams to "look right"; just set the line width relative to some arbitrary scale (e.g. assuming the final diagram will fit into a 1x1 box) and then applysized
to the final diagram to make it that given arbitrary size. It can also be used for easily making something (a diagram, path, trail, ...) the same size as something else, with the help of the newsizeSpec2D
function. 
New
sizedAs
function, for setting the size of some object to be "the same as" some other object. 
New
sizeSpec2D
function for conveniently calculating the size of an object as aSizeSpec2D
value (for use with the newsized
funtion).


New
extrudeEnvelope
andintrudeEnvelope
functions for modifying envelopes in a single direction only, as well as new functionsextrude{Left,Right,Bottom,Top}
specializingextrudeEnvelope
to 2D. 
arcCW
draws clockwise arcs;arc'
draws arcs counterclockwise or clockwise as the radius is positive or negative, respectively. 
fill color attribute is generalized to support "recommended" and "committed" colors; text objects use a recommended fill color of black.


New instances

The
Show
instance forR2
now produces something like2 & 6
instead ofR2 { unR2 = (2,6) }
. TheRead
instance has also been changed to match, soread . show = id
. 
Enveloped
instance forFixedSegment

Traced
instances forSegment
,FixedSegment
,Trail
, andPath

New derived
Eq
instances forLineCapA
,LineJoinA
,Dashing
,DashingA
,FillRule
,Font
,FontSize
,FontSlant
,FontSlantA
,FontWeight
, andFontWeightA

Renderable Ellipsoid NullBackend
instance


API changes

Data.Colour
(minusatop
andAffineSpace
) is now reexported from Diagrams.Prelude for convenience. 
The
beneath
function is now infixl 6. 
The
BoundingBox
module has had a complete overhaul. There is now a special empty bounding box, and bounding boxes are an instance ofMonoid
. 
The type of
withEnvelope
has been slightly generalized. 
Diagrams.TwoD.Adjust.adjustSize
is now deprecated; it has been renamed and moved toDiagrams.TwoD.Size.requiredScaleT
. 
expandPath
has been renamed toscalePath
.


Dependency/version changes
 Allow
datadefault
0.4 and 0.5  Allow
base
4.6  Allow
containers
0.5
 Allow

Bug fixes
arc
andarcT
functions now always produce counterclockwise arcs, as claimed.
0.5: 9 March 2012

New features
mkSizeSpec
function for constructing aSizeSpec2D
from twoMaybe Double
sbeneath
as convenient synonym forflip atop
 Improvements and extensions to rounded rectangles by Peter Hall:
roundedRect'
allows rounded rectangles with a different radius specified for each corner both
roundedRect'
androundedRect
now allow negative radii, resulting in "inverted" circular corners
 #64: New
Alignable
class for things that can be aligned. explodeTrail
andexplodePath
have been generalized to return anyPathLike
type. New path functions
pathCentroid
(compute the centroid of a path's vertices) andexpandPath
(scale a path about its centroid).  Generalized
centroid
function now exported from new moduleDiagrams.Points
.  Initial (experimental) support for animation:
Animation
andQAnimation
defined as synonyms forActive
diagrams (seeactive
package) Instances for
Active
:V
,HasOrigin
,Transformable
,HasStyle
,PathLike
,Juxtaposable
,Alignable
animEnvelope
andanimRect
functions for automatic bounding of animations
addClosingSegment
function for making the implicit closing segment of a closed trail explicit Improvements to
BoundingBox
module from Michael Sloan: querying ofBoundingBox
bounds, corners, extents, and transformation of objects to fit within a given box.  Text alignment options from Michael Sloan
view
function for restricting a diagram's envelope to a rectangular region.iterateN
function for iterating a finite number of timesatAngle
for placing two diagrams next to each other along a specified angle.padX
andpadY
functions for padding in the X and Ydirections independently. generalized
showOrigin
function from Ian Ross  #40: add shears to
Diagrams.TwoD.Transform

Performance improvements
 Use a balanced folding scheme for
cat'
, reducing time in some cases from \(O(n^2)\) to \(O(n \log n)\)  More efficient implementation of
beside
 Use a balanced folding scheme for

New instances
Alignable
instances forQDiagram
,Path
,Envelope
,Active
,Set
,Map
,[]
Renderable
instances forNullBackend
(Trail
,Path
,Segment
,Image
,Text
) Instances for
Active
:V
,HasOrigin
,Transformable
,HasStyle
,PathLike
,Juxtaposable
,Alignable

API changes
R2
used to be a synonym for(Double, Double)
but is now abstract. To convert between pairs ofDoubles
andR2
, use the new functionsr2
andunr2
. There are two reasons for this change: 1. to allow for future changes to the implementation ofR2
; 2.(Double, Double)
was an awkward special case getting in the way of useful tuple instances for classes likeHasOrigin
,Enveloped
, and so on.circlePath
has been removed; its functionality has been subsumed bycircle
.adjustSegment
now takes an extra tolerance option. Ellipses are now represented using Bezier approximations rather than a separate special type.
BoundingBox
no longer has aTransformable
instance; the old instance was misleading at best. Change semantics of
beside
(hence also()
and(===)
) so the result's origin is the same as that of the first argument. adjustDia2D
now takes aSizeSpec2D
.beside
and related functions are now implemented in terms ofjuxtapose
. Instead of taking an
R2
,roundedRect
now takes a pair ofDouble
s, to be more consistent withrect
.

Dependency/version changes
 Support for GHC 7.4.1:
 depend on
colour
>= 2.3.2  update
base
andarray
upper bounds
 depend on
 bump
vectorspace
upper bound
 Support for GHC 7.4.1:

Bug fixes
 Avoid scale by zero error in
showOrigin
.  Base
adjustDia2D
translation on output size rather than diagram size.
 Avoid scale by zero error in
0.4.0.1: 30 October 2011
 bump
datadefault
dependency to allow version 0.3
0.4: 23 October 2011

documentation fixes

New functions and primitives
wedge
shape primitivefromDirection
function for converting angles to 2D unit vectors; inverse functiondirection
generalized to return any Angle type New functions for computing and adjusting segment lengths
scaleUToX
andscaleUToY
for doing uniform scales resulting in a desired width or height.circlePath
,reversePath
,decoratePath

New features
 Completely new and improved polygon generation API
 Cubic splines
 Usercontrollable path fill rules

Bug fixes
 fix incorrect corner case in arc generation
 fix incorrect
reverseTrail
function
0.3: 18 June 2011

New features
 new customizable
stroke'
function which lets you assign names to path vertices circle
andsquare
functions now take a size argument function for adjusting 2D diagrams to requested size abstracted from cairo backend
 generalize
PathLike
class to include an instance for diagrams, and collapse things likepolygon
/polygonPath
into a single polymorphic function  basic text support
 basic support for external images
 very sketchy initial proofofconcept library of 3D primitives. See also diagramspovray package.
 new customizable

Bug fixes
 Issue 32 (
mempty
not behaving correctly within concatenations)
 Issue 32 (
0.2: 3 June 2011

documentation fixes

New functions and primitives
scaleToX
andscaleToY
for scaling to an absolute width/heightreverseTrail
 new
Angle
class and ability to use radians, degrees, or circle fractions for specifying angles rotateAbout
andreflectAbout
transformations based on new conjugation functionsrect
androundedRect
primitivesexplodeTrail
/Path
for breaking trails and paths into individual segments

New features
 opacity attribute
 support for path clipping

New modules
Diagrams.BoundingBox

Fixes and updates
withBounds
now properly uses the new bounds instead of just combining them with the old
0.1.1: 18 May 2011
 minor documentation fixes
 link to new website
0.1: 17 May 2011
 initial preview release