-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Simple heuristic for packing discs of varying radii in a circle
--   
--   Given a number of circles with their radii, this packags tries to
--   arrange them tightly, without overlap and forming a large circle.
--   
--   Finding the optimal solution is NP hard, so only heuristics are
--   feasible. This particular implementation is neither very good nor very
--   fast, compared to the state of the art in research. Nevertheless it is
--   simple to use and gives visually acceptable results.
--   
--   You can explore the algorithm live at
--   <a>http://darcs.nomeata.de/circle-packing/ghcjs/ghcjs-demo.html</a>.
--   
--   Contributions of better algorithms are welcome.
@package circle-packing
@version 0.1.0.6


module Optimisation.CirclePacking

-- | <a>packCircles</a> takes a list of circles and a function that yields
--   the radius of the circle.
--   
--   It returns a list of all circles, in unspecified order, together with
--   coordinates such that they do not overlap but sit as tight as
--   possible, filling a large circle.
--   
--   Finding the optimal solution to this is NP hard, so only heuristics
--   are feasible. This particular implementation is neither very good nor
--   very fast, compared to the state of the art in research. Nevertheless
--   it is simple to use and gives visually acceptable results.
--   
--   The heuristics begins by placing the largest circle first, and the
--   next-to-largest next to it. From then on it adds circles by
--   considering all points where the circle to be added would touch two
--   circles but overlap with none, and picks the one that is closest to
--   the center of mass of the current placements.
packCircles :: (a -> Double) -> [a] -> [(a, (Double, Double))]
