riverPath.module
README.md
riverPath
Spline, ribbon and flow-field helpers for running water, used by the river, stream and waterfall kinds (and by anything else that needs water laid along a path).
RiverPath.parse(path): points from"x,y,z; x,y,z"text or a list of{x,y,z}.RiverPath.build(points, opts): a centripetal Catmull-Rom centreline through the points (upstream first), resampled everystepmetres, heights held non-increasing downstream (or laid on agroundY(x, z)probe plusgroundOffset), with per-sample tangent, side, arc length, slope, Manning current (flowScale,roughness, clamped tominSpeed..maxSpeed), rapids amount (rapids,rapidsSlope), width (withwidthVariation) and depth.RiverPath.manning(depth, slope, roughness?): surface speed of a wide channel.RiverPath.ribbon(path, { cross, stride, bankDrop }): the water mesh: uv = (metres across, metres along), vertex colour = (speed/10, rapids, slope*5, across 0..1), tangent = downstream.RiverPath.bedMesh(path, { bankWidth, bankHeight, cross, stride }): a carved channel and banks for a river standing where no terrain was cut for it.RiverPath.waterGrid(path, opts): aPhysics.defineWatergridbody: level, bed and a per-texelflow(x, z m/s) along the channel, fastest mid-stream, soPhysics.water,FluidForcesandBuoyancycarry bodies downstream.RiverPath.nearest(path, x, z): the nearest sample and the offset across/along it.