úÎ;8á&      !"#$% Safe-Inferred+F&Represents a Quadrant in the 2D plane. South East South West North East North West!A list of all quadrants. Same as  [NW .. SE].None+FAn integral coordinate.yA rectangular area of the 2D plane. We keep the type abstract to ensure that invalid extents cannot be constructed.MConstruct an extent. The north value must be > south, and east > west, else &. &Take the NSEW components of an extent.  A square extent of a given size. &Get the width and height of an extent. <Check if an extent is a square with a width and height of 1. 1Check whether a coordinate lies inside an extent.,Check whether a point lies inside an extent.8Get the coordinate that lies at the center of an extent."Cut one quadrant out of an extent.6Get the quadrant that this coordinate lies in, if any.8Constuct a path to a particular coordinate in an extent.ªIf a line segment (P1-P2) intersects the outer edge of an extent then return the intersection point, that is closest to P1, if any. If P1 is inside the extent then '. ‡ P2 / ----/- | / | + | /------ / P1 hCheck whether a line segment's endpoints are inside an extent, or if it intersects with the boundary.( y max (north) y min (south) x max (east) x min (west)   ( None+FHMThe quad tree structure.A node with four children.A leaf containint some value.An empty node.A  tree. A node with . for all its branches.LGet a quadrant from a node. If the tree does not have an outer node then '.sApply a function to a quadrant of a node. If the tree does not have an outer node then return the original tree.dInsert a value into the tree at the position given by a path. If the path intersects an existing  then return the original tree.{Insert a value into the node containing this coordinate. The node is created at maximum depth, corresponding to an unit .$Lookup a node based on a path to it. +Lookup an element based given a path to it.!=Lookup a node if a tree given a coordinate which it contains."IFlatten a QuadTree into a list of its contained values, with coordinates.#IFlatten a QuadTree into a list of its contained values, with coordinates. !"Extent that covers the whole tree.$Coordinate of the value of interest.""Extent that covers the whole tree.#"Extent that covers the whole tree. !"# !"#  !"#None+FHM$²The quadtree contains cells of unit extent (NetHack style). Given a line segement (P1-P2) through the tree, get the cell closest to P1 that intersects the segment, if any.ETODO: 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.%¦The quadtree contains cells of unit extent (NetHack style). 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 convering the whole tree. The tree.;Intersection point, extent of cell, value of cell (if any).)*%(P1) Starting point of seg.(P2) Final point of seg.Extent covering the whole tree. The tree.2Intersection point, extent of cell, value of cell.$%$%$)*%+      !"#$%&'()*+,-+./ 012gloss-algorithms-1.9.2.1Graphics.Gloss.Data.QuadGraphics.Gloss.Data.ExtentGraphics.Gloss.Data.QuadTree!Graphics.Gloss.Algorithms.RayCastQuadSESWNENWallQuadsCoordExtent makeExtent takeExtent squareExtent sizeOfExtent isUnitExtent coordInExtent pointInExtentcenterCoordOfExtentcutQuadOfExtent quadOfCoord pathToCoordintersectSegExtenttouchesSegExtentQuadTreeTNodeTLeafTNil emptyTree emptyNodetakeQuadOfTree liftToQuad insertByPath insertByCoordlookupNodeByPath lookupByPath lookupByCoordflattenQuadTreeflattenQuadTreeWithExtentscastSegIntoCellularQuadTreetraceSegIntoCellularQuadTreebaseGHC.Errerror Data.MaybeNothingcompareDistanceTodistance