&      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~  &The OpenGL library doesn'%t seem to provide a nice way convert ' a Float to a GLfloat, even though they're the same thing  under the covers. )Using realToFrac is too slow, as it doesn't get fused in at  least GHC 6.12.1 )Render a circle with the given thickness :Decide how many line segments to use to render the circle Render a circle as a line. ;Render a circle with a given thickness as a triangle strip  -The commands suported by the view controller   Simulation state The iteration number we' re up to. 7Whether the animation is free-running (or single step) ASignals to callbackIdle to take a single step of the automation. ;Signals to callbackIdle to roll-back to the initial world. ?How many simulation setps to take for each second of real time 'How many seconds worth of simulation we've done so far Record how many steps we've been taking per frame Initial control state   Dump the internal state of GLUT .Dump internal state of the OpenGL framebuffer .Dump internal state of the fragment renderer. Holds callback functions.  Animation State "Whether the animation is running. 2Whether this is the first frame of the animation. 2Number of msec the animation has been running for EThe time when we entered the display callback for the current frame. >Clamp the minimum time between frames to this value (in msec) 5 Most LCD monitors refresh at around 50Hz so setting  this to < 20msec probably isn't worthwhile. CThe time when the last call to the users render function finished. KThe time when displayInWindow last finished (after sleeping to clamp fps). $How long it took to draw this frame  $State for controlling the viewport. 3 These are used by the viewport control component. .The command list for the viewport controller. 9 These can be safely overwridden at any time by deleting / adding entries to the list. 3 Entries at the front of the list take precedence. AHow much to scale the world by for each step of the mouse wheel. DHow many degrees to rotate the world by for each pixel of x motion. During viewport translation, , where the mouse was clicked on the window. During viewport rotation, + where the mouse was clicked on the window The initial view state. Render options settings Whether to use color %Whether to force wireframe mode only Whether to use alpha blending Whether to use line smoothing Default render options "Handles animation timing details. 0 Call this function at the start of each frame. "Handles animation timing details. . Call this function at the end of each frame. 4Callback to handle keyboard and mouse button events  for controlling the viewport. ,-.Global translation. /Global rotation (in degrees). 0.Global scaling (of both x and y coordinates). #The initial state of the viewport. ,-./0,-./0-./0;Perform a rendering action whilst using the given viewport The viewport to use. !The rendering action to perform. 8The graphics library calls back on this function when it's finished drawing  and it's time to do some computation. the simulation state the animation statea the viewport state the current world the initial world fn to advance the world #how much time to advance world by  in single step mode 1'Represents a Quadrant in the 2D plane. 2 South East 3 South West 4 North East 5 North West 6!A list of all quadrants. Same as  [NW .. SE]. 12345615432615432234567A point on the x-y plane. ! Points can also be treated as Vectors, so Graphics.Gloss.Data.Vector may also be useful. 8DTest whether a point lies within a rectangular box that is oriented F on the x-y plane. The points P1-P2 are opposing points of the box, * but need not be in a particular order.   P2 +-------+  | |  | + P0 |  | |  +-------+ P1 Pretend a point is a number.  Vectors aren'4t real numbes according to Haskell, because they don't F support the multiply and divide field operators. We can pretend they A are though, and use the (+) and (-) operators as component-wise  addition and subtraction. 7878789Convert degrees to radians :Convert radians to degrees ;4Normalise an angle to be between 0 and 2*pi radians 9:;9:;9:; <3A vector can be treated as a point, and vis-versa. =The magnitude of a vector. >6The angle of this vector, relative to the +ve x-axis. ? The dot product of two vectors. @ The determinant of two vectors. AMultiply a vector by a scalar. BJRotate a vector by an angle (in radians). +ve angle is counter-clockwise. C:Compute the inner angle (in radians) between two vectors. D0Normalise a vector, so it has a magnitude of 1. ECProduce a unit vector at a given angle relative to the +ve x-axis. # The provided angle is in radians. <=>?@ABCDE <=>?@ABCDE <=>?@ABCDE FMCheck if line segment (P1-P2) clears a box (P3-P4) by being well outside it. P1 First point of segment. P2 Second point of segment. P3 Lower left point of box. P4 Upper right point of box. G(Given an infinite line which intersects P1 and P1, 2 return the point on that line that is closest to P3 P1 P2 P3 /the point on the line P1-P2 that is closest to P3 H3Given an infinite line which intersects P1 and P2, 8 let P4 be the point on the line that is closest to P3. GReturn an indication of where on the line P4 is relative to P1 and P2.    if P4 == P1 then 0  if P4 == P2 then 1 2 if P4 is halfway between P1 and P2 then 0.5    |  P1  |  P4 +---- P3  |  P2  | P1 P2 P3 IYGiven four points specifying two lines, get the point where the two lines cross, if any. W Note that the lines extend off to infinity, so the intersection point might not lie . between either of the two pairs of points.   \ /  P1 P4  \ /  +  / \  P3 P2  / \ P1 P2 P3 P4 JGet the point where a segment P1-P2 crosses an infinite line P3-P4 , if any. P1 P2 P3 P4 KAGet the point where a segment crosses a horizontal line, if any.   + P1  /  -------+---------  / y0  P2 + P1 First point of segment. P2 Second point of segment. y value of line. L?Get the point where a segment crosses a vertical line, if any.   |  | + P1  | /  +  / |  P2 + |  | x0 P1 First point of segment. P2 Second point of segment. x value of line. MGet the point where a segment P1-P2 crosses another segement P3-P4 , if any. P1 P2 P3 P4 N?Check if an arbitrary segment intersects a horizontal segment.   + P2  /  (xa, y3) +---+----+ (xb, y3)  /  P1 + P1 First point of segment. P2 Second point of segment. $(y3) y value of horizontal segment. -(xa) Leftmost x value of horizontal segment. .(xb) Rightmost x value of horizontal segment. %(x3, y3) Intersection point, if any. O=Check if an arbitrary segment intersects a vertical segment.   (x3, yb) +  | + P1  | /  +  / |  P2 + |  + (x3, ya) P1 First point of segment. P2 Second point of segment. !(x3) x value of vertical segment )(ya) Lowest y value of vertical segment. *(yb) Highest y value of vertical segment. %(x3, y3) Intersection point, if any. FGHIJKLMNO FGHIJKLMNO FGHIJKLMNOPAn integral coordinate. Q$A rectangular area of the 2D plane. S We keep the type abstract to ensure that invalid extents cannot be constructed. RConstruct an extent. 8 The north value must be > south, and east > west, else . y max (north) y min (south)  x max (east)  x min (west) S'Take the NSEW components of an extent. T!A square extent of a given size. U'Get the width and height of an extent. V=Check if an extent is a square with a width and height of 1. W2Check whether a coordinate lies inside an extent. X-Check whether a point lies inside an extent. Y9Get the coordinate that lies at the center of an extent. Z#Cut one quadrant out of an extent. [7Get the quadrant that this coordinate lies in, if any. \9Constuct a path to a particular coordinate in an extent. ]fIf a line segment (P1-P2) intersects the outer edge of an extent then return the intersection point, B that is closest to P1, if any. If P1 is inside the extent then .   P2  /  ----/-  | / |  + |  /------  /  P1 ^Check whether a line segment'Is endpoints are inside an extent, or if it intersects with the boundary. PQRSTUVWXYZ[\]^QPRSTUVWXYZ[\]^PQRSTUVWXYZ[\]^ _The quad tree structure. `A node with four children. aA leaf containint some value. bAn empty node. cA b tree. d A node with b. for all its branches. eGet a quadrant from a node. 0 If the tree does not have an outer node then . f*Apply a function to a quadrant of a node. J If the tree does not have an outer node then return the original tree. g>Insert a value into the tree at the position given by a path. & If the path intersects an existing a then return the original tree. h9Insert a value into the node containing this coordinate. B The node is created at maximum depth, corresponding to an unit Q. i%Lookup a node based on a path to it. j,Lookup an element based given a path to it. k>Lookup a node if a tree given a coordinate which it contains. #Extent that covers the whole tree. %Coordinate of the value of interest. lJFlatten a QuadTree into a list of its contained values, with coordinates. #Extent that covers the whole tree. mJFlatten a QuadTree into a list of its contained values, with coordinates. #Extent that covers the whole tree. _`abcdefghijklm_ba`cdefghijklm_ba``abcdefghijklm4Callback to handle keyboard and mouse button events  for controlling the viewport. ref to ViewPort state ref to ViewPort Control state   4Callback to handle keyboard and mouse button events  for controlling the viewport. ref to ViewPort state ref to ViewPort Control state       9:;FGHIJKLMNO nAn abstract color value. A We keep the type abstract so we can be sure that the components 7 are in the required range. To make a custom color use o. CHolds the color components. All components lie in the range [0..1. oCMake a custom color. All components are clamped to the range [0..1]. Red component. Green component. Blue component. Alpha component. pDMake a custom color. All components are clamped to the range [0..255]. Red component. Green component. Blue component. Alpha component. q%Take the RGBA components of a color. 5Clamp components of a color into the required range. =Normalise a color to the value of its largest RGB component. r&Mix two colors with the given ratios. Ratio of first color. Ratio of second color.  First color. Second color. Resulting color. s=Add RGB components of a color component-wise, then normalise G them to the highest resulting one. The alpha components are averaged. t9Make a dimmer version of a color, scaling towards black. u;Make a brighter version of a color, scaling towards white. vLighten a color, adding white. wDarken a color, adding black. x!A greyness of a given magnitude. "Range is 0 = black, to 1 = white. yz{|}~nopqrstuvwxyz{|}~nopqrstuvwxyz{|}~nopqrstuvwxyz{|}~ #Convert one of our Colors to OpenGL's representation. !FOpen a window and use the supplied callbacks to handle window events. Name of the window. 'Initial size of the window, in pixels. 7Initial position of the window, in pixels relative to $ the top left corner of the screen. Color to use when clearing. Callbacks to use   A 2D picture (A picture consisting of several others. /A picture scaled by the given x and y factors. 3A picture rotated by the given angle (in degrees). 7A picture translated by the given x and y coordinates. !A picture drawn with this color. &Some text to draw with a vector font. _A circle with the given thickness and radius. If the thickness is 0 then this is equivalent to .  A circle with the given radius.  A line along an arbitrary path. %A polygon filled with a solid color. %A blank picture, with nothing in it. A path through the x-y plane. A closed loop along this path. ;A path representing a rectangle centered about the origin, " with the given width and height. 1A wireframe rectangle centered about the origin, " with the given width and height. :A wireframe rectangle in the y > 0 half of the x-y plane, " with the given width and height. DA path representing a rectangle in the y > 0 half of the x-y plane, ! with the given width and height .A solid rectangle centered about the origin, " with the given width and height. 5A sold rectangle in the y > 0 half of the x-y plane, " with the given width and height. !7<!7< <The quadtree contains cells of unit extent (NetHack style). A Given a line segement (P1-P2) through the tree, get the cell 6 closest to P1 that intersects the segment, if any. <TODO: This currently uses a naive algorithm. It just calls   and sorts the results ) to get the one closest to P1. It'd be better to do a @ proper walk over the tree in the direction of the ray. (P1) Starting point of seg. (P2) Final point of seg. !Extent convering the whole tree.  The tree. <Intersection point, extent of cell, value of cell (if any). <The quadtree contains cells of unit extent (NetHack style). L Given a line segment (P1-P2) through the tree, return the list of cells  that intersect the segment. (P1) Starting point of seg. (P2) Final point of seg.  Extent covering the whole tree.  The tree. 3Intersection point, extent of cell, value of cell. ">Render a picture using the given render options and viewport. The render options to use The current viewport. The picture to render. Turn alpha blending on or off Turn line smoothing on or off #1Open a new window and display the given picture. 4Use the following commands once the window is open:  Quit - esc-key. . Move Viewport - left-click drag, arrow keys. E Rotate Viewport - right-click drag, control-left-click drag, or home/ end-keys. ( Zoom Viewport - mouse wheel, or page up/ down-keys. Name of the window. 'Initial size of the window, in pixels. +Initial position of the window, in pixels. Background color. The picture to draw. $3Open a new window and display the given animation. >Once the window is open you can use the same commands as with displayInWindow. Name of the window. 'Initial size of the window, in pixels. +Initial position of the window, in pixels. Background color. 2Function to produce the next frame of animation. = It is passed the time in seconds since the program started.  %XRun a finite-time-step simulation in a window. You decide how the model is represented, ] how to convert the model to a picture, and how to advance the model for each unit of time.  This function does the rest. >Once the window is open you can use the same commands as with displayInWindow. Name of the window. 'Initial size of the window, in pixels. +Initial position of the window, in pixels. Background color. ANumber of simulation steps to take for each second of real time. The initial model. .A function to convert the model to a picture. >A function to step the model one iteration. It is passed the = current viewport and the amount of time for this simulation  step (in seconds). @,-./07<nopqrstuvwxyz{|}~,-./0& Possible input events. Run a game in a window. Name of the window. 'Initial size of the window, in pixels. +Initial position of the window, in pixels. Background color. ANumber of simulation steps to take for each second of real time. The initial world. +A function to convert the world a picture. #A function to handle input events. ,A function to step the world one iteration. H It is passed the period of time (in seconds) needing to be advanced. !Callback for KeyMouse events. ref to world state fn to handle input events "#Callback for Motion events. ref to world state fn to handle input events $%j  !"#$%&'()*+7<nopqrstuvwxyz{|}~0$!"# +%&'()*  <7<nopqrstuvwxyz{|}~&'()'(*'(+'(,'(-'(.'(/'(0'(1'(2'(3'(4'(5'(6'(7'(8'(9'(:'(;'(<'(='(>'(?'(@'(A'(B'(C'(D'(E'(F'(G'(H'(H'(I'(A'(J'(K'LM'LN'LO'LP'LQ'LR'LJSSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                   #$%&&&&      w !"#$%&'()* + , - .!/!0!1!2!3!4 5 6"7"8"9":";$&<&=&>&?&@A gloss-1.2.0.1Graphics.Gloss.Interface.Game!Graphics.Gloss.Interface.SimulateGraphics.Gloss.Data.QuadGraphics.Gloss.Data.PointGraphics.Gloss.Geometry.AngleGraphics.Gloss.Data.VectorGraphics.Gloss.Geometry.LineGraphics.Gloss.Data.ExtentGraphics.Gloss.Data.QuadTreeGraphics.Gloss.Data.ColorGraphics.Gloss.Data.Picture!Graphics.Gloss.Algorithms.RayCastGraphics.Gloss&Graphics.Gloss.Internals.Render.Common&Graphics.Gloss.Internals.Render.Circle3Graphics.Gloss.Internals.Interface.ViewPort.Command1Graphics.Gloss.Internals.Interface.Simulate.State(Graphics.Gloss.Internals.Interface.Debug+Graphics.Gloss.Internals.Interface.Callback0Graphics.Gloss.Internals.Interface.Animate.State8Graphics.Gloss.Internals.Interface.ViewPort.ControlState'Graphics.Gloss.Internals.Render.Options1Graphics.Gloss.Internals.Interface.Animate.Timing3Graphics.Gloss.Internals.Interface.ViewPort.Reshape.Graphics.Gloss.Internals.Interface.Common.Exit+Graphics.Gloss.Internals.Interface.ViewPort(Graphics.Gloss.Internals.Render.ViewPort0Graphics.Gloss.Internals.Interface.Simulate.Idle4Graphics.Gloss.Internals.Interface.ViewPort.KeyMouse2Graphics.Gloss.Internals.Interface.ViewPort.MotionGraphics.Gloss.GeometryGraphics.Gloss.Internals.Color)Graphics.Gloss.Internals.Interface.Window'Graphics.Gloss.Internals.Render.Picture*Graphics.Gloss.Internals.Interface.Display*Graphics.Gloss.Internals.Interface.Animate+Graphics.Gloss.Internals.Interface.Simulate'Graphics.Gloss.Internals.Interface.Game GLUT-2.2.2.0!Graphics.UI.GLUT.Callbacks.WindowKeyF1KeyF2KeyF3KeyF4KeyF5KeyF6KeyF7KeyF8KeyF9KeyF10KeyF11KeyF12KeyLeftKeyUpKeyRightKeyDown KeyPageUp KeyPageDownKeyHomeKeyEnd KeyInsert KeyNumLockKeyBegin KeyDelete SpecialKeyDownUpKeyStatealtctrlshift ModifiersChar MouseButtonKeyGraphics.UI.GLUT.Types LeftButton MiddleButton RightButtonWheelUp WheelDownAdditionalButtonViewPortviewPortTranslateviewPortRotate viewPortScaleQuadSESWNENWallQuadsPoint pointInBoxdegToRadradToDegnormaliseAngleVectormagVargVdotVdetVmulSVrotateVangleVV normaliseVunitVectorAtAngle segClearsBoxclosestPointOnLineclosestPointOnLineParamintersectLineLineintersectSegLineintersectSegHorzLineintersectSegVertLineintersectSegSegintersectSegHorzSegintersectSegVertSegCoordExtent makeExtent takeExtent squareExtent sizeOfExtent isUnitExtent coordInExtent pointInExtentcenterCoordOfExtentcutQuadOfExtent quadOfCoord pathToCoordintersectSegExtenttouchesSegExtentQuadTreeTNodeTLeafTNil emptyTree emptyNodetakeQuadOfTree liftToQuad insertByPath insertByCoordlookupNodeByPath lookupByPath lookupByCoordflattenQuadTreeflattenQuadTreeWithExtentsColor makeColor makeColor8 rgbaOfColor mixColors addColorsdimbrightlightdarkgreyNblackwhiteredgreenblueyellowcyanmagentarosevioletazure aquamarine chartreuseorangePicturePicturesScaleRotate TranslateText ThickCircleCircleLinePolygonBlankPathblankpolygonlinecircle thickCircletextcolor translaterotatescalepictureslineLoop rectanglePath rectangleWirerectangleUpperWirerectangleUpperPathrectangleSolidrectangleUpperSolidcastSegIntoCellularQuadTreetraceSegIntoCellularQuadTreedisplayInWindowanimateInWindowsimulateInWindowEvent EventMotionEventKey gameInWindowgf renderCircle circleStepsrenderCircleLine_steprenderCircleLinerenderCircleStriprenderCircleStrip_stepCommandCBumpCClockwiseCBumpClockwise CBumpDownCBumpUp CBumpRight CBumpLeft CBumpZoomIn CBumpZoomOutCRotate CTranslateCRestoredefaultCommandConfig isCommandStatestateIterationstateRun stateStep stateResetstateResolution stateSimTimestateStepsPerFrame stateInit dumpGlutStatedumpFramebufferStatedumpFragmentStateCallbackReshapeMotionIdleKeyMouseDisplay stateAnimatestateAnimateStartstateAnimateTimestateDisplayTimestateDisplayTimeLaststateDisplayTimeClampstateGateTimeStartstateGateTimeEndstateGateTimeElapsed stateCommandsstateScaleStepstateRotateFactorstateTranslateMarkstateRotateMarkOptions optionsColoroptionsWireframeoptionsBlendAlphaoptionsLineSmooth optionsInit animateBegin animateEnd getsIORefcallback_viewPort_reshapeviewPort_reshape callback_exit keyMouse_exit viewPortInit withViewPortcallback_simulate_idlesimulate_reset simulate_run simulate_step$fNum(,)baseGHC.Errerror Data.MaybeNothingcallback_viewPort_keyMouseviewPort_keyMouse controlZoomIncontrolZoomOut motionBumpcallback_viewPort_motionviewPort_motionmotionTranslate motionRotateRGBA clampColornormaliseColorglColor4OfColor createWindowcallbackDisplaycallbackReshapecallbackKeyMousecallbackMotion callbackIdlecompareDistanceTodistance renderPicture drawPicture setBlendAlpha setLineSmooth vertexPFscallback_keyMousehandle_keyMousecallback_motion handle_motion convertPoint