(index ("make-grid" 0) ("indexer" 168) ("horizontal-wrapper" 407) ("vertical-wrapper" 638) ("within-bounds?" 865) ("east" 1084) ("northeast" 1084) ("northwest" 1084) ("west" 1084) ("southwest" 1084) ("southeast" 1084) ("directions" 1686) ("grid->world" 1880) ("world->grid" 2503) ("normalized-hex-verts" 3148) ("hex-verts" 3361) ("distance" 4073) ("distance-nowrap" 4717) ("grid-world-size" 4899) ("radius-to-fit" 5225) ("origin-to-center" 5624) ("row-height" 6116) ("inner-radius" 6398))
(def (sig (procedure "(make-grid grid-size) => vector" (id make-grid))) (p "Return a vector representing an hexagonal grid of " (tt "grid-size") " columns and rows."))
(def (sig (procedure "((indexer grid-size) cell) => integer" (id indexer))) (p "Return the index corresponding to the given " (tt "cell") " in the vector returned by " (tt "make-grid") ".  Bounds will be checked.") (p "(Note: curried.)"))
(def (sig (procedure "((horizontal-wrapper width) cell) => cell" (id horizontal-wrapper))) (p "Return the position equivalent to " (tt "cell") " with the horizontal coordinate wrapped at " (tt "width") ".") (p "(Note: curried.)"))
(def (sig (procedure "((vertical-wrapper height) cell) => cell" (id vertical-wrapper))) (p "Return the position equivalent to " (tt "cell") " with the vertical coordinate wrapped at " (tt "height") ".") (p "(Note: curried.)"))
(def (sig (procedure "((within-bounds? grid-size) cell) => boolean" (id within-bounds?))) (p "Return #t if " (tt "cell") " is within the bounds expressed in " (tt "grid-size") ", #f otherwise.") (p "(Note: curried.)"))
(def (sig (procedure "(east cell) => cell" (id east)) (procedure "(northeast cell) => cell" (id northeast)) (procedure "(northwest cell) => cell" (id northwest)) (procedure "(west cell) => cell" (id west)) (procedure "(southwest cell) => cell" (id southwest)) (procedure "(southeast cell) => cell " (id southeast))) (p "Return the cell adjacent to " (tt "cell") " in the corresponding direction.  Bounds are not checked not wrapped around; compose " (tt "horizontal-wrapper") ", " (tt "vertical-wrapper") " and/or " (tt "within-bounds?") " with these, if you want wrapping and/or checking versions."))
(def (sig (constant "directions" (id directions))) (p "A list with " (tt "(east northeast northwest west southwest southeast)") ", to make it convenient to collect the adjacencies of a cell."))
(def (sig (procedure "((grid->world origin hex-radius) cell) => point" (id grid->world))) (p "Return the world/screen coordinates of the center of " (tt "cell") ".") (p (tt "origin") " is the position, in world/screen coordinates, of the cell at row 0, column 0.") (p (tt "hex-radius") " is the distance, in world/screen coordinates, between the center of a hexagon and any of its vertices (which is the same as the length of one hexagon side).") (p "No bounds wrap-around or checking is done.  See " (tt "horizontal-wrapper") ", " (tt "vertical-wrapper") " or " (tt "within-bounds?") " for that.") (p "(Note: curried.)"))
(def (sig (procedure "((world->grid origin hex-radius) point) => cell" (id world->grid))) (p "Return the grid coordinates of the hexagon that contains the world/screen " (tt "point") ".") (p (tt "origin") " is the position, in world/screen coordinates, of the cell at row 0, column 0.") (p (tt "hex-radius") " is the distance, in world/screen coordinates, between the center of a hexagon and any of its vertices (which is the same as the length of one hexagon side).") (p "No bounds wrap-around or checking is done.  See " (tt "horizontal-wrapper") ", " (tt "vertical-wrapper") " or " (tt "within-bounds?") " for that.") (p "(Note: curried.)"))
(def (sig (constant "normalized-hex-verts" (id normalized-hex-verts))) (p "A list containing the world/screen coordinates of six points corresponding to the vertices of a hexagon centered at 0,0 with radius 1."))
(def (sig (procedure "((hex-verts origin hex-radius) cell) => (6 points)" (id hex-verts))) (p "A list containing the world/screen coordinates of six points corresponding to the vertices of a hexagon at " (tt "cell") " with radius " (tt "hex-radius") ".") (p (tt "origin") " is the position, in world/screen coordinates, of the cell at row 0, column 0.") (p (tt "hex-radius") " is the distance, in world/screen coordinates, between the center of a hexagon and any of its vertices (which is the same as the length of one hexagon side).") (p "No bounds wrap-around or checking is done.  See " (tt "horizontal-wrapper") ", " (tt "vertical-wrapper") " or " (tt "within-bounds?") " for that.") (p "(Note: curried.)"))
(def (sig (procedure "((distance grid-size) cell1 cell2) => integer" (id distance))) (p "Return how many steps does it take to go from " (tt "cell1") " to " (tt "cell2") ", where a step means moving to an adjacent cell.  Provide a valid width and/or height in " (tt "grid-size") " if you want to allow wrapping around that direction, or #f in the respective position otherwise.  For example " (tt "((distance '(5 #f)) '(1 2) '(3 4))") "  will wrap horizontally assuming the grid has width 5, and it will not wrap vertically at all.  Bounds are not checked in any case.  Use " (tt "within-bounds?") " if you want that.") (p "(Note: curried.)"))
(def (sig (procedure "(distance-nowrap cell1 cell2) => integer" (id distance-nowrap))) (p "Same as " (tt "(distance '(#f #f))") ", that is, straight distance with no wrap around."))
(def (sig (procedure "(grid-world-size grid-size hex-radius) => world-size" (id grid-world-size))) (p "Return the size, in screen/world units, of a grid of " (tt "grid-size") " columns and rows if the distance from hexagon centers to their vertices (or, equivalently, the length of hexagon sides) is " (tt "hex-radius") "."))
(def (sig (procedure "(radius-to-fit grid-size container-size margin) => hex-radius" (id radius-to-fit))) (p "Return the longest hexagon radius (or, equivalently, hexagon side length) such that a grid of " (tt "grid-size") " columns and rows will fit in " (tt "container-size") " world/screen units, with " (tt "margin") " world/screen units left at both sides in the most constrained direction."))
(def (sig (procedure "(origin-to-center grid-size hex-radius container-size) => origin" (id origin-to-center))) (p "Return the position, in world/screen coordinates, for the center of the hexagon at column 0 and row 0, so a grid with " (tt "grid-size") " columns and rows where each hexagon has " (tt "hex-radius") " distance from center to vertices (or, equivalently, side length) will be centered in a container of " (tt "container-size") " width and height in world/screen coordinates."))
(def (sig (constant "row-height" (id row-height))) (p "The vertical distance between centers of hexagons in successive rows, if the hexagon radius (that is, the distance between the hexagon center and any of its vertices) or, equivalently, the length of the hexagon sides, is 1."))
(def (sig (constant "inner-radius" (id inner-radius))) (p "The distance between the center of a hexagon and the midpoint of any of its sides.  This is also the horizontal distance between the centers of adjacent hexagons in different rows, or half the distance between the centers of adjacent hexagons in the same row."))
