darwindarak/Gadfly.jl — pull request #1 by tlycken (2014-06-12 13:13:38+00:00)
Title: Decoupled contouring algorithm from plotting

I made an attempt to decouple the code and algorithm, so that the contour curves can be used for other things except plotting. I haven't tested it on anything exotic yet, but my main idea was to wrap the calls to `get_level_cells` and `trace_contour` in a new function `contours`, which can be used to extract the contour lines explicitly, and then use that function inside of `contour_layers`. Basically, this allows for releasing the `Contours` in its own package, e.g. `Contours.jl`, which `Gadfly.jl` can use to generate contour plots (but which could also be used for other things).

While I was at it, I decided to remove a lot of the type arguments in your function definitions, to allow for other types of iterables (e.g. ranges). As long as we do some size checking, that shouldn't be a problem. A summary of the type changes:

* Removed types on function arguments where they weren't needed for multiple dispatch
* Changed `Int64` to `Int` to run well on 32-bit systems
* Removed requirement on contour levels to be `Float64`s - now e.g. `trace_contour(x,y,z,3)` is also valid. Promotion will handle the mathematics, so everything should work as before.

I also took the liberty of defining a simpler constructor for the `ContourLines` type.