← hex_ground · version 0.1.6
28 public items, in source order. Generated from the registry index, which re-derives them from the package source at publish time — so a signature here is the one that version actually ships.
pub struct Ground { gr_heights: Heights, gr_kinds: Labels, gr_q0: integer, gr_r0: integer, gr_w: integer, gr_h: integer, gr_step: float }
The ground over a window of cells: a height and a surface kind per cell, and its step.
pub fn ground_new(q0: integer, r0: integer, w: integer, h: integer, step: float, kind: integer) -> Ground
@FR-HG-Surface: a height and a surface kind per cell Flat ground at height 0 over the window, every cell of surface kind, centres step apart.
pub fn ground_unit(step: float) -> float
The ground's unit per lattice world unit (a hex's circumradius): what a point of hex_draw's outlines is multiplied by to lie on the ground.
pub fn ground_centre(step: float, q: integer, r: integer) -> (float, float)
A cell's centre, in a ground's unit.
pub fn ground_cell_near(step: float, x: float, y: float) -> (integer, integer)
The cell whose centre is nearest (x, y), in a ground's unit.
pub struct GroundMeasures { gm_storey: float, gm_hillside: float, gm_bank: float, gm_blend: float }
The ground's measurements, in its unit: a storey (the height between two levels), how wide a hillside is between two terraces, how wide a bank, and how far round a seated structure the ground blends back to its own height.
pub fn ground_measures(storey: float, hillside: float, bank: float, blend: float) -> GroundMeasures
The four measurements.
pub struct GroundSteps { gs_x0: float, gs_y0: float, gs_size: float, gs_nx: integer, gs_ny: integer, gs_level: vector<integer> }
A stepped height map on a square grid: a level per square (level[j * nx + i]), squares size units a side, square (0, 0) with its south-west corner at (x0, y0), j growing north.
pub fn steps_level(s: const GroundSteps, i: integer, j: integer) -> integer
The level of square (i, j), the nearest square's beyond the map.
pub fn terrace_height(s: const GroundSteps, x: float, y: float, m: const GroundMeasures, lo: integer, hi: integer) -> float
@FR-HG-Terrace: each step up a smooth slope across its edge; the flat tops stay flat The smooth height at (x, y) units of the stepped map s: its lowest level's height, and for every step up a smooth rise of a storey across the step's edge, hillside wide and centred on it (a step up from below level 0, a stream's bank, bank wide). Away from the edges the terraces stay flat at their storeys; across one, the ground climbs a storey without a cliff.
pub fn ground_terraces(g: Ground, s: const GroundSteps, m: const GroundMeasures, lo: integer, hi: integer)
Every cell of the ground at the smooth height of the stepped map.
pub fn ground_hill(g: Ground, x: float, y: float, radius: float, height: float)
@FR-HG-Hill: a smooth round hill A round hill height units high, radius units across from its top at (x, y) to its foot: added to the ground, its sides a cosine, level at the top and at the foot.
pub fn ground_seat(g: Ground, cells: HexSet, z: float, m: const GroundMeasures) -> float
@FR-HG-Seat: a structure's footprint level, the ground round it blended back Seat a structure on the ground: its cells at height z, and the ground round it blended from that height back to its own over m.gm_blend from the footprint's edge (hex_place::seat_blend). Answers the lowest the ground was under the footprint, where its walls go down to.
pub fn ground_dig(g: Ground, cells: HexSet, depth: float, m: const GroundMeasures)
@FR-HG-Dig: a structure dug in, its bank centred on its straight sides Dig a structure into the ground (a stream's bed): the ground inside its sides depth units lower, across a bank m.gm_bank wide centred on its sides (hex_draw::cells_outlines, the same straight sides the view draws its edge along), shaped by a smoothstep. So the bank runs along the sides, not along the cells' zigzag or the square map's staircase.
pub fn sides_distance(sides: const vector<(float, float, float, float)>, x: float, y: float) -> float
How far (x, y) lies from the nearest of the sides, positive inside them (counted over all their loops), negative outside.
pub fn ground_around(step: float, xs: const vector<float>, ys: const vector<float>, reach: float, z: float) -> Ground
@FR-HG-Surface: the window a structure's ground needs Flat ground at height z round a structure: over the window that holds the outline (xs, ys) and reach units round it, a cell to spare on every side, centres step apart.
pub fn ground_cells_under(g: const Ground, xs: const vector<float>, ys: const vector<float>) -> HexSet
@FR-HG-Seat: a structure stands on the cells of its outline and of its walls' outer half The cells a structure with outline (xs, ys) stands on, to seat it (ground_seat): those whose centre lies inside the outline or within half a step outside it. The cells inside alone leave the outer half of its walls on ground blending away from it — a step down at a door no one takes.
pub fn ground_triangles(g: const Ground, xs: const vector<float>, ys: const vector<float>) -> vector<float>
@FR-HG-Surface: the ground ends against a structure's outline The ground as it is drawn — each cell's six triangles about its centre, at ground_corner_height's corners — less what lies inside the outline (xs, ys), so it ends against a structure's outer faces as its floors do inside: a triangle the outline crosses cut along it (hex_roof::roof_plane_faces: the triangle's plane less the outline's pieces laid on it). No outline: every triangle whole. Eleven numbers a triangle: its cell's centre (x, y), then its three corners (x, y, z), turning the way the cell's own do (anticlockwise seen from above).
pub fn ground_quads(q: hex_edge::Quads, tris: const vector<float>, mat: integer)
The ground's triangles (ground_triangles) as faces into q, of material mat, part hex_edge::PART_TOP (walked on, stopping nothing): a triangle a quad with its last corner twice.
pub struct GroundCliff { gc_level: integer, gc_ax: float, gc_ay: float, gc_bx: float, gc_by: float }
A stretch of cliff (the ground's unit): a straight side of the ground of level and up, walked with that ground on its left from (ax, ay) to (bx, by); the ground drops a storey across it.
pub struct GroundBox { gb_x0: float, gb_y0: float, gb_x1: float, gb_y1: float }
An area where fronts are cliffs, in units: x0 .. x1 east, y0 .. y1 north.
pub fn ground_cliffs(levels: Labels, q0: integer, r0: integer, w: integer, h: integer, lo: integer, hi: integer, areas: const vector<GroundBox>, step: float) -> vector<GroundCliff>
@FR-HG-Cliff: a cliff where the ground steps a level within a cliff area, along its straight sides The cliffs of ground whose cells stand at levels (lo .. hi): for each level, the straight sides of the cells at it and above (hex_draw::cells_outlines), the stretches of them inside the cliff areas. Elsewhere the fronts slope.
pub fn ground_box_distance(b: const GroundBox, x: float, y: float) -> float
How far (x, y) lies outside the box (0 inside).
pub fn ground_sharpen(g: Ground, sharp: Heights, areas: const vector<GroundBox>, m: const GroundMeasures)
Make the ground's fronts sharp in the cliff areas: each cell at its level's height, sharp (its level's storey), within them, the smooth ground it has beyond m.gm_blend from them, blended between.
pub fn ground_corner_height(g: const Ground, k: integer, m: integer) -> float
@FR-HG-Surface: a corner's height is the mean of the cells round it The height of the corner at doubled coordinates (k, m): the mean of the cells round it that the ground's window holds, 0 when it holds none. (k, m) must be a corner of the lattice.
pub fn ground_height_at(g: const Ground, x: float, y: float) -> float
The ground's height at (x, y), in its unit, as it is drawn: within the triangle of its cell's fan that holds the point, between the cell's centre and two of its corners.
pub fn ground_normal_at(g: const Ground, x: float, y: float) -> (float, float, float)
@FR-HG-Surface: the ground's way up, for light that runs on across its faces The ground's normal at (x, y): the way up from its surface as it is drawn, of unit length, from its slope across half a step either way (ground_height_at). Lit by it at each corner, the faces of a cell's fan and its neighbours' take one light where they meet, so the ground reads as one surface, not as the triangles it is drawn in. On a plane it is the plane's normal exactly.
pub fn ground_height_on(g: const Ground, levels: const Labels, x: float, y: float, level: integer, high: boolean, storey: float) -> float
@FR-HG-Cliff: either side of a cliff its own surface, from the cells on that side only The ground's height at (x, y) on one side of a cliff of level: on its high side (high, the cells of level and up, by levels) or its low one. Each corner is the mean of the cells round it on that side only, so the ground does not slope down the cliff. A corner with no cell on that side, or the centre of a cell on the other, takes that side's own height: its level times storey.