nx_wind_erosion.nx
buildroot/runtime/nx_wind_erosion.nx
about
nx_wind_erosion.nx -- directional anisotropic erosion generator.
Fourth demonstration of the kind-specific-generator cardinal
`feedback-kind-specific-generators-not-broad-noise`. Previous
shipped kind-generators:
nx_forest_layout -- scattered features (Poisson-like)
nx_river_carve -- polyline path
nx_beach_zone -- banded zone
This one:
nx_wind_erosion -- directional anisotropic vector field
Wind doesn't erode terrain uniformly. A south-facing slope under
north wind gets MORE scour than a north-facing slope under the
same wind. And on the leeward side, blown-particle deposition
builds dunes. This primitive captures that anisotropy.
Wind-internal logic in v1:
- 4 cardinal wind directions (NORTH/EAST/SOUTH/WEST) for an
anisotropic dot-product test. Caller supplies LOCAL SLOPE
(dh/dx, dh/dz) at the query point.
- Windward factor = dot product of wind direction with slope.
Positive = facing into the wind (exposed) -> erode.
Negative = facing downwind (sheltered) -> deposit dunes.
- Two strength params (scour + dune) so caller tunes erosion
and deposition independently.
V2 follow-ups (queued):
- 8 cardinal directions (add NE/SE/SW/NW with diagonal slopes)
- Arbitrary wind angle in degrees + sin/cos lookup via nx_camera_q14
- Multi-step wind history (prevailing wind + occasional storms)
- Wind speed / strength field varying over space (terrain shadow)
- Particle transport modeling (sand grains move from windward to
leeward; equilibrium dunes emerge)
- Composes with nx_beach_zone v2 dune-barrier model
- Composes with nx_weather_pattern for storm-driven episodic events
Loss audit: Q14 integer arithmetic; dot product is exact. Signed
delta scales the strength params linearly; no information loss
beyond Q14 quantisation.
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 63 | const NX_WIND_Q: nx_int = 16384 |
| 72 | const NX_WIND_DIR_NORTH: nx_int = 0 |
| 73 | const NX_WIND_DIR_EAST: nx_int = 1 |
| 74 | const NX_WIND_DIR_SOUTH: nx_int = 2 |
| 75 | const NX_WIND_DIR_WEST: nx_int = 3 |
| 77 | const NX_WIND_DIR_COUNT: nx_int = 4 |
functions
| 80 | func nx_wind_dir_is_valid(d: nx_int) -> nx_int |
| 118 | func nx_wind_dir_dot( |
| 144 | func nx_wind_erosion_delta( |
| 161 | func nx_wind_erosion_at( |
| 174 | func main() -> i64 |