-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Implements an osculatory packing (kissing circles) algorithm and display. -- -- Implements the simple algorithm for packing an area with circles that -- are 'mutually tangent' as well as functions for displaying the image -- on-screen. @package oscpacking @version 0.3.0.0 module Graphics.OscPacking.Geometry data Circle Circle :: Point -> Float -> Circle position :: Circle -> Point radius :: Circle -> Float type Point = (Float, Float) type Metric = Point -> Point -> Float euclidean :: Metric distToCircle :: Point -> Circle -> Float module Graphics.OscPacking.Interpret type Interpretation = [Circle] -> Picture -- | All circles are white monoWhite :: Interpretation -- | Takes a hue value (HSL) and returns a Gloss Color hue :: Float -> Color -- | Provides a multi-colored interpretation which tends to scale smoothly -- across the hues as the radius grows colorful :: Float -> Interpretation -- | Provides a multi-colored interpretation which gives a seemingly random -- show of the hues cycling :: Float -> Float -> Interpretation module Graphics.OscPacking.Boundary -- | A Boundary is a function which takes a Point and -- determines if it is inside some area. If the Point is outside the -- area, it returns Nothing. Otherwise, it returns the distance to -- the edge of the area. Any such Boundary need not be a simple, -- traditional geometric shape. Though, it is often difficult to -- calculate the distance for more exotic shapes. type Boundary = Point -> Maybe Float -- | Provides a Boundary for a circle of given origin and radius. circleB :: Point -> Float -> Boundary -- | Provides a Boundary for a rectangle of given origin and -- dimensions rectB :: Point -> Float -> Float -> Boundary module Graphics.OscPacking.Packing -- | The initializing parameters for a particular packing image, minus the -- actual display parameters such as color. data Packing Packing :: Float -> Float -> Maybe Float -> Maybe Boundary -> [Circle] -> Int -> Int -> Packing boxWidth :: Packing -> Float boxHeight :: Packing -> Float capRadius :: Packing -> Maybe Float boundary :: Packing -> Maybe Boundary startingCircles :: Packing -> [Circle] seedX :: Packing -> Int seedY :: Packing -> Int -- | Some sensible default parameters provided for convenience. defaultPacking :: Packing -- | Generates an infinite list of circles, using a packing algorithm pack :: Packing -> [Circle] module Graphics.OscPacking.Paint -- | Generating a packing from Packing parameters and convert into a -- Picture buildPicture :: Interpretation -> Packing -> Int -> Picture -- | Display a picture in a window on-screen displayWindow :: (Int, Int) -> Color -> Picture -> IO () -- | Display a picture in full-screen mode displayFullscreen :: (Int, Int) -> Color -> Picture -> IO () module Graphics.OscPacking -- | Please be aware that breaking changes to example functions will not be -- represented as such for purposes of package versioning. Do not link to -- example functions from production code. module Graphics.OscPacking.Examples -- | Packs a rectangle with circles. -- --
--   example1 :: IO()
--   example1 =
--     do putStrLn "Packing. Please be patient."
--        displayWindow (800, 600) black $
--          buildPicture interpretation packing totalcircles
--     where packing = defaultPacking { boxWidth = 800.0,
--                                      boxHeight = 600.0,
--                                      seedX = 42,
--                                      seedY = 11,
--                                      boundary = Just (rectB (20, 20) 760 560),
--                                      startingCircles =
--                                        [Graphics.OscPacking.Circle
--                                          { position = (400, 300), radius = 10 }] }
--           totalcircles = 1500
--           interpretation = cycling 0.05 200
--   
example1 :: IO () -- | Packs a circle with circles. -- --
--   example2 :: IO()
--   example2 =
--     do putStrLn "Packing. Please be patient."
--        displayWindow (800, 600) black $
--          buildPicture interpretation packing totalcircles
--     where packing = defaultPacking { boxWidth = 600.0,
--                                      boxHeight = 600.0,
--                                      seedX = 331,
--                                      seedY = 2010,
--                                      boundary = Just (circleB
--                                                       (600.0 / 2, 600.0 / 2) 250),
--                                      startingCircles =
--                                        [Graphics.OscPacking.Circle
--                                          { position = (300, 300), radius = 10 }] }
--           totalcircles = 1500
--           interpretation = colorful 270
--   
example2 :: IO ()