Monday, January 31, 2011

wumpus-basic

Copperbox revision 2099.

I've added aligned versions of the PosGraphic combinators. Tomorrow I'll have to sort out the Haddock documentation and look at improving the names for the CtxPicture combinators (which have lost the "prime names" to PosGraphic).

Update: The PosGraphic type was wrong, it has been rectified but the composition operators have been dropped as they used 'introspection' that the corrected type does not support.

wumpus-basic

Copperbox revision 2098.

More work on concatenation / combinators for PosGraphic. I've now added list versions, alignment ones are next...

wumpus-basic

Update: The PosGraphic type was wrong, it has been rectified but the composition operators have been dropped as they used 'introspection' that the corrected type does not support.

Copperbox revision 2097.
 
I've implemented horizontal and vertical concatenation for PosGraphic:

wumpus-basic

Update: The PosGraphic type was wrong, it has been rectified but the composition operators have been dropped as they used 'introspection' that the corrected type does not support.


Copperbox revision 2096.

I've added semigroup (OPlus) instances to PosGraphic - concatenation works by composing PosGraphic's at the center:

Sunday, January 30, 2011

wumpus-basic

Update: The PosGraphic type was wrong, it has been rectified but the composition operators have been dropped as they used 'introspection' that the corrected type does not support.

Copperbox revision 2095.

I've replaced PosImage with a simpler object - PosGraphic. My intention is that PosGraphic should also supersede Bounded and possibly AdvanceGraphic.

PosGraphic is in progress, but it should be able to support picture language like operations once I have added a semigroup instance.

wumpus-block

Copperbox revision 2094.

More work on the Csound block diagrams. At the moment the code is not very substantial, as I'm feeling my way through how the node objects should work.

Saturday, January 29, 2011

wumpus-drawing

Copperbox revision 2093.

I've implemented more of the new anchors on the Shapes.

wumpus-drawing

Copperbox revision 2092.

First round of work implementing the new anchor classes for the shapes.

wumpus-basic

Copperbox revision 2091.

I've added some new anchor classes for apex and corners. My thinking has changed somewhat on what will be suitable anchors, I suspect corner anchors might be more useful for block diagrams than cardinal anchors and I'll probably change the Rectangle shape (in Wumpus-Drawing) to have proper radial positions for the cardinal anchors rather than corner positions. As cardinal anchors can usually be computed more efficiently than radial anchors it seems sensible to keep both even though there is redundancy.

Friday, January 28, 2011

wumpus-block

Copperbox revision 2090.

I've started a new library Wumpus-Block to make block diagrams in the style used throughout the Csound book. This should be a good driver to improve Wumpus as block diagrams use shapes, connectors etc. heavily.

Thursday, January 27, 2011

wumpus

Copperbox revision 2089.

Updates to Basic, Drawing and Tree to get the demos to compile again.

wumpus-drawing

Copperbox revision 2088.

I've fixed the bug in Semicircle and Semiellipse that was cause the inverted versions to be drawn in the wrong place.

Here are InvSemicircle and InvSemiellipse:


wumpus-drawing

Copperbox revision 2087.

I've implemented radial anchors on the semi-ellipse shape. I've also committed inverse (upside down) versions of semicircle and semi-ellipse. Disappointingly anchors don't work properly on these two, I thought I'd got a fix on the anchor problem yesterday...


wumpus-drawing

Copperbox revision 2086.

I've tidied up the Geometry modules somewhat - removing the StrictCurve module (the functionality is moved into Base and Intersection) and giving LineSegment a proper type.

wumpus-drawing

Copperbox revision 2085.

I've now implemented radial anchors for the semicircle shape. The anchors are found by curve subdivision - there is probably a geometric or trig formula that is faster but I haven't found it yet.

Here's a semicircle rotated by 10 degrees:


Wednesday, January 26, 2011

wumpus-drawing

Copperbox revision 2084.

I've fixed the affine transformation problem on InvTriangle. The fix was splitting the Shape representation so just the path LocThetaCF function gets rotated by the invtriangle constructor.

wumpus-drawing

Copperbox revision 2083.

Work correcting a flaw in Shapes where affine transformations didn't work. I've corrected the problem for the "original" shapes, but InvTriangle which is a Triangle rotated 180 degrees doesn't work. This is because the rotation factor is treated as an affine transformation and the Triangle gets rotated about the drawing origin and not the shape center.

Currently I'm not sure how to fix this.

wumpus-drawing

Copperbox revision 2082.

Initial work on Bezier wedges and curve-line intersection.

Tuesday, January 25, 2011

wumpus-drawing

Copperbox revision 2081.

I've added a function pointLineDistance - this is a prelude to find intersection points on curves. Also I've fixed some compile errors that the changes to Intersection caused.

wumpus-drawing

Copperbox revision 2080.

I've re-implemented the Geometry.Intersection module. I'd have checked in the code a hour ago, but I've been chasing a bug that ended up due to using <= on Doubles. First Floating Point bug of the year...

wumpus-drawing

Copperbox revision 2079.

Work on line intersection and the Geometry modules. The new intersection code is on-going and isn't sufficient to replace the old code yet, however as a lot of modules have changed a commit was worthwhile.

Monday, January 24, 2011

wumpus-drawing

Copperbox revision 2078.

I've added decorations to Shapes so they can support text labels for example.

wumpus-drawing

Copperbox revision 2077.

I've changed the internal representation of Shapes to be a LocThetaCF rather than a LocCF. This means individual shapes don't need to define r-prefix constructors for rotated versions.

wumpus-drawing

Copperbox revision 2076.

I've renamed the LocShape type to Shape and made it a newtype wrapper rather than a type synonym.

Sunday, January 23, 2011

wumpus-drawing

Copperbox revision 2075.

I've added an inverse (i.e. apex downwards) triangle shape. I'd overlooked that shapes probably should have "ang constructors" to construct them with some angle of rotation. I've added an "ang constructor" to Triangle so I can build InvTriangle via a newtype wrapper, but I'll have to look at doing this to systematically to the other shapes. 

wumpus-drawing

Copperbox revision 2074.

Triangle border points via quadrant trigonometry now working.

wumpus-drawing

Copperbox revision 2073.

The trapezoid QI function is now working but the triangle border function isn't.

Here's a picture that shows rightTrapezoidQI is okay:

wumpus-drawing

Copperbox revision 2072.

Work towards "quadrant calculations" for finding radial points on a triangles border. The code is in place but the test shows it currently doesn't work.

Saturday, January 22, 2011

wumpus-drawing

Copperbox revision 2070.

I've added a new module Geometry.Quadrant for "quadrant" trig calculations like which quadrant a point is in and where does a point meet the edge of a rectangle.

Update - Copperbox revision 2071.

I've now added a function to find a radial point on a diamond to Geometry.Quadrant, plus updated the Diamond shape to use it.

wumpus-drawing

Copperbox revision 2069.

I've moved all the Shape demos into one module. Also I've put the Semiellipse shape in the Shape shim even though it currently doesn't have a satisfactory set of anchors defined.

Friday, January 21, 2011

wumpus-drawing

Copperbox revision 2068.

More work on Shapes - the changes to bezier curves in Wumpus-Core and Wumpus-Basic allow some of the shapes to be simplified. I've also added a semiellipse shape, although it doesn't have a good set of anchor points.

wumpus

Copperbox revision 2067.

Work documenting the DrawingPrimitives module in Wumpus-Basic and some documentation improvements to Wumpus-Core.

wumpus-core

Copperbox revision 2066.

I've added a function to generate the control points of a rotated ellipse and a new example to test it.

wumpus-basic

Copperbox revision 2065.

I've split up the type and the drawing functions in the Objects.Graphic module, moving the drawing functions into a new module Objects.DrawingPrimtives.

wumpus-core

Copperbox revision 2064.

I've re-implemented the function bezierCircle - it is now more efficient (computationally in Haskell) and generates more efficient Bezier circles (always just four Bezier curves). The new implementation also generalizes to draw ellipses very easily, so I've added a bezierEllipse function.

Thursday, January 20, 2011

new release - wumpus-core-0.42.1

Copperbox revision 2062.

Fixed a bug in the function curvedPath in Core.Picture - curvedPath was using the wrong point to calculate the relative position of the third point in the Bezier curve.

Copperbox revision 2063.

New archive for Hackage - wumpus-core-0.42.1.

wumpus-drawing

Copperbox revision 2061.

More work on the semicircle shape. For the moment, semicircle will have less anchors than other shapes as I'm not sure how to define radial anchors for it.

wumpus-drawing

Copperbox revision 2060.

Initial work on a semicircle shape. Note - the calculation for finding the center is arbitrary, I've just measured a proportion that "looks good". I'll have to search the web for a proper method.

Update: cminor = (4 * radius) / (3 * pi)



I've also found the formula for circle sectors which might be handy.

Wednesday, January 19, 2011

wumpus-drawing

Copperbox revision 2059.

I've fixed the parallelogram - previous it was a "square-a-llelogram" i.e. all the side lengths were the same length rather than opposite sides needing to be the same length.

wumpus-drawing

Copperbox revision 2058.

Initial work on a parallelogram shape. Parallelograms can be made with the trapezium shape - however this builds them with a bad center (the center is not the center of gravity), so a special case is merited.

wumpus-drawing

Copperbox revision 2057.

I've added a trapezium shape.

Note - the new work on Shapes is suggesting the anchors defined in Wumpus-Basic are not really satisfactory. Interpreting compass points differently depending on the shape seems wrong - currently compass points can mean corners (rectangle) or proper radial positions (trapezium).




Tuesday, January 18, 2011

wumpus

Copperbox revision 2056.

I've added a Cardinal datatype to Wumpus-Basic enumerating the compass points and I've implemented more anchors for the Triangle shape:

wumpus-core

Copperbox revision 2055.

I've changed the internal representation of EscapedText so that it supports efficient concatenation and defined a Monoid instance for it.

wumpus-basic

Copperbox revision 2054.

I've put the displacement functions and types into a separate module and added some new displacement functions. As the new displacement functions take names previously used for projecting anchors, I've changed the Anchors module removing the functions northwards, southwards etc. and and a function projectAnchor which can be used to re-define them.

wumpus-drawing

Copperbox revision 2053.

Initial work on an isosceles triangle shape. A triangle is somewhat different to manipulate than the shapes defined so far (rectangle, circle, diamond, ellipse) - there is more 'geometry' involved in defining anchor points.

Monday, January 17, 2011

wumpus-drawing

Copperbox revision 2052.

I've updated the examples to compile again. Examples with centered text look better now, the new implementation of LRText finds a better balanced vertical center - halfway between descender and cap height.

wumpus

Copperbox revision 2051.

Minor updates improving the LRText API - and moving the ignoreAns function into Wumpus-Basic.

Sunday, January 16, 2011

wumpus

Copperbox revision 2050.

Finally the new LRText implementation is working properly, though there are some things to tidy up and the API needs a bit of work. Here's a sample:

wumpus-drawing

Copperbox revision 2049.

I've removed the old code and cleaned up the API of LRText. In fact the API is too clean - it needs some simpler default functions to draw non-rotated text. Also bounding box calculation is wrong for rotated text, tracing this bug down is taking some effort.

wumpus-drawing

Copperbox revision 2049.

I've made the re-implemented LR text functions return a bounding box. This means they have the same functionality as the original ones, but soon they will have a better API.

wumpus-drawing

Copperbox revision 2047.

I've now implemented left- and center-aligned multi-line text using PosImage. The code at the moment is quite untidy as I haven't removed any of the old code - LRText can probably lose about half its lines of code.

wumpus-drawing

Copperbox revision 2046.

Work towards implementing multi-line text with PosImage. Right aligned text is implemented - the alignment is correct but I haven't yet checked that its drawn in the right place.

wumpus-drawing

Copperbox revision 2045.

Work towards implementing LRText using PosImage. I've got a single line version working - currently it doesn't return a bounding box (I'm now on the fence as to whether LRText should return a bounding box).

 

wumpus-basic

Copperbox revision 2044.

I've added descender depth to the font metrics - my thinking is that using cap-height and descender as the vertical span of a font will make centering more visually appealing than using the bounding box height of the font, which seems to be drawing "centered" text too low.

Saturday, January 15, 2011

wumpus-basic

Copperbox revision 2043.

I've added a PosImage object to Wumpus-Basic. This is a rectangular object that can be drawn at any of its corners (other rectangles in Wumpus can only be drawn from their center or baseline left).

The idea for PosImage is to use it as a container for at least LRText. LRText should be readily positionable, but currently it isn't as the number of functions exported by API would have exploded. PosImage avoids this by encoding all positions in an Enum.

wumpus

Copperbox revision 2042.

More work on grids in Wumpus-Drawing and Wumpus-Basic. I've now put the grid code into the Wumpus-Drawing library rather than embed it in an example.

wumpus-drawing

Copperbox revision 2041.

I've implemented rudimentary grid drawing. As I don't know where to put it yet, most of the code is actually in the TableChains demo rather than the library proper.

Friday, January 14, 2011

wumpus - new releases

Copperbox revision 2039.

Updates to .cabal files etc. before making archives for Hackage.


Copperbox revision 2040.

New releases for Hackage:
wumpus-core-0.42.0
wumpus-basic-0.15.0
wumpus-drawing-0.1.0
wumpus-tree-0.13.0
wumpus-microprint-0.14.0

wumpus-core

Copperbox revision 2038.

I've done a round of improving the Haddock docs as I'm going to make a new release and the only outstanding change wasn't otherwise big enough to merit uploading to Hackage (correcting the fold problems with JoinList).

During the doc improvements, I decided to remove the function oboundingBox as it was unused and had bad semantics, so Wumpus-Core gets a major version bump.

wumpus

Copperbox revision 2037.

I've added margins to bounded text - the DrawingContext has been extended with a margin property in Wumpus-Basic, which LRText (in Wumpus-Drawing) queries for drawing.

Thursday, January 13, 2011

wumpus-drawing

Copperbox revision 2036.

I've removed the Paths.RoundCorners module - the code is now in Paths.Base. Also the Paths.Construction module is now Paths.MonadicConstruction.

wumpus-drawing

Copperbox revision 2035.

I've reimplemented connector paths and arrows to use more appropriate types - as a lot of the code is actually quite old in Wumpus and the core types have changed quite often, some objects sometimes get the easiest change to make them work rather than a re-think.The recent work on Wumpus-Drawing has improved a lot of them.

wumpus-drawing

Copperbox revision 2034.

I've fixed arrow tips to draw with a solid line. For connectors with a dashed connector line, the tips still look better solid than dashed. I've also made the Diamond shape account for rounded corners and fixed a bug in the rounded cornering code.

Wednesday, January 12, 2011

wumpus

Copperbox revision 2033.

I've added round_corner_factor to the Drawing Context in Wumpus-Basic and added round corner drawing for rectangle shapes. Rounding for the diamond shape and paths will follow.

Having rounding in the Drawing Context seems better than the previous implementation, where shapes were obliged to have two build-functions: one for the rounded version and one for the angular one.

wumpus-basic

Copperbox revision 2032.

I've added a JoinList to Wumpus-Basic that I will probably use for Paths. Whether it will end up being more efficient than Data.Seq is debatable - Data.Seq is more complicated but it is optimized, so I ought to optimize the JoinList too. 

wumpus-drawing

Copperbox revision 2031.

I've reworked Shapes. Shapes are now a LocCF type so they are positioned with `at` like other drawing objects. Currently rounded corners support has been dropped - this needs adding to Paths as a transformation and Paths themselves need a rework.

Tuesday, January 11, 2011

wumpus

Copperbox revisions 2029 and 2030.

I've moved the Geometry modules from Wumpus-Basic to Wumpus-Drawing. I've also changed the type of the "path" generating functions to LocCoordPath which is a functional type from Point to [Point]. This new type should be more generally useful than the previous one that generated PrimPaths.

Monday, January 10, 2011

wumpus-drawing

Copperbox revision 2027.

I've reworked point generating chains. The new code is much simpler - no special encoding of a unfold, but it can support the same functionality.

The only apparent problem is that it needs to support two different drawing styles, thus it needs two sets of unzipping "run" functions. These functions are not suitable for a type class, and the current names are not appealing.

Copperbox revision 2028.

Adding a new chains example that should have been committed last time.

Sunday, January 9, 2011

wumpus

Copperbox revision 2026.

I've simplified ScalingContext in Wumpus-Basic. The monad and transformer have been removed as they were inducing to unwieldy type signatures. Instead code code must reference the ScalingContext directly (the monads were Readers so this is not too bad).

The code in Drawing, Tree and Microprint has been updated accordingly.

wumpus-tree

Copperbox revision 2025.

Some tidying up of Wumpus-Tree. Also, I've updated the Wumpus-Core guide to acknowledge the splitting of Wumpus-Basic into Wumpus-Basic and Wumpus-Drawing.

Saturday, January 8, 2011

wumpus

Copperbox revision 2024.

Updates to Wumpus-Tree and Wumpus-Microprint.

I've removed the top-level shim from Microprint as it was prioritizing the teletype drawing style which is now out-of-date. After the next release I might let Microprint bit-rot, with the intention of polishing it up again later. At least in the current version, Microprint drawings are too trivial to advance Wumpus but the code needs significant work for tokenizing etc. As this doesn't help Wumpus, this is work I'm happy to make a low priority.

wumpus-basic and wumpus-drawing

Copperbox revisions 2021, 2022 and 2023.

I've split Wumpus-Basic into two packages - Wumpus-Basic and Wumpus-Drawing. This is to distinguish the Drawing modules where the code is very prototypical and under-cooked from the Basic code which still needs polish but is more developed.

wumpus-tree

Copperbox revision 2020.

I've unified the code for normal and family tree rendering styles. The API needs improving though.

Friday, January 7, 2011

wumpus-tree

Copperbox revision 2019.

I've changed the original demos to work with the new monadic types and functions. The family tree drawing hasn't been changed yet - I need to abstract the connector drawing code first.

wumpus-tree

Copperbox revision 2018.

I've added tree growing direction so trees can be drawn growing left, up, or right as well as down. With the root-orientation code in place from revision 2017, this is just a matter of rotating a tree design about the root.


Note - there is a minor imperfection in the line from root 'a' to the single child, this is because text dots are not exactly centered yet so the 0 radian anchor is not properly at the east.

wumpus-tree

Copperbox revision 2017.

I've added a reposition step to the tree design - this moves the tree, positioning its root at the supplied point. Previously the tree was drawn at more or less arbitrary location - probably the leftmost node was drawn at (0,0).

Thursday, January 6, 2011

wumpus-tree

Copperbox revision 2016.

I've added annotations on nodes anchors - annotations are made on tree nodes before the tree is drawn. During the rendering process the annotation is placed correctly w.r.t. the node.

tree2 :: (Real u, Floating u, FromPtSize u) => TreeBuild u (ZTreeSpec u)
tree2 = do
    special   <- nodeId $ dotText "a"   
    rightmost <- nodeId $ dotText "z"
    annotate rightmost (\ancr -> textline "....anno" `at` southeast ancr )
    let bs = [zleaf, zleaf, zleaf]
    let gs = [zleaf, zleaf, leaf $ rightmost ]
    return $ 
      branch special [zbranch bs, zleaf, zbranch gs]


Here's the picture:

wumpus-tree

Copperbox revision 2015.

Some renaming, plus a change to to the output type. Drawing a tree should produce a TraceDrawing not a Picture - TraceDrawings can more readily be amalgamated into other drawings.

wumpus-tree

Copperbox revision 2014.

I've moved the TreeBuild monad out of the demo and into its on module, Though the actual monad needs renaming - I didn't spot this before I made the commit.

wumpus-tree

Copperbox revision 2013.

I've added a prototype monadic tree builder. This allows nodes to be references via bind so that they can be attributed differently to the rest of the tree. Here's an example where "root" is a special node:

Wednesday, January 5, 2011

wumpus-basic

Copperbox revision 2012.

Updating the demos to work with the renaming change (Drawing to CtxPicture).

wumpus-basic

Copperbox revision 2011.

I've renamed the Drawing type in Wumpus-Basic to CtxPicture. Having an unrelated name to its Wumpus-Core ancestor was confusing for me, let alone any users.

Monday, January 3, 2011

wumpus-core

Copperbox revision 2010.

Wumpus-Core had the same mismatched left and right fold bug on the Join List that ZMidi-Emit had (unsurprising as the code was copied from into ZMidi-Emit from Wumpus-Core). The bug has been fixed and the examples that called left-fold have been checked and work as expected.

zmidi-emit

Copperbox revision 2009.

Fixed a bug in the internal JoinList where the defintion of foldl was actually a foldr and foldr was a foldl. I've also added two new examples.

wumpus-rhythm

Copperbox revision 2008.

Updates to track the changes in ZMidi-Emit.

zmidi-emit

Copperbox revision 2007.

I've added volume control to ZMidi-Emit, and a new example to demonstrate it.

Sunday, January 2, 2011

zmidi-emit

Copperbox revision 2006.

More work polishing the interface - I've renamed the Build monad to NoteList and hidden the module that defines it, exporting only want needs to be exposed in the Construction module.

The code is now complete enough for a release, the remaining work is to add some better examples.

zmidi-emit

Copperbox revision 2005.

Work tidying up the the construction interface. I've hidden the Datatypes module and moved the syntax building functions into the Contruction module (this is the Constructors module now renamed). Also functions to add info text (copyright notice, lyrics, ...) have been added.

Saturday, January 1, 2011

head-strict-stream

Copperbox revision 2004.

I've added Haddock docs and INLINE pragmas. With the INLINE pragmas I've tried to follow what seems to be the use-pattern in the 'stream fusion' library.

head-strict-stream

Copperbox revision 2003.

More work, including instances for the Numeric types.

head-strict-stream

Copperbox revision 2002.

A new project - head-strict-stream. I'm intending to work up the prototypical ZWav and synthesis code to something more useful, the first part of this is making a (fairly) efficient version of the infinite Stream data type. This time round I'm coding it in the Stream-Fusion iterative style.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.