applyTerrainStroke
applyTerrainStroke(
grid,stroke,selected?):TerrainChange
Runs one stroke’s tool over the grid, dab by dab, and returns the
points it touched with their offsets before and after. Sculpt raises,
or lowers with lower; Smooth moves each point toward the average of
its four neighbours; Flatten moves each toward level, or the height
under the stroke’s first point. Every tool writes an offset over the
base. Given the cells a stroke’s where selected, the tool runs once
on their corners in place of the dabs.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
grid |
HeightGrid |
stroke |
{ clear: boolean; erase: boolean; families?: ScatterFamily[]; level?: number; lower: boolean; material?: string; multiplier?: number; points: [number, number][]; radius: number; shape: "circle" | "square"; strength: number; tool: "scatter" | "paint" | "sculpt" | "smooth" | "flatten"; where?: string; } |
stroke.clear |
boolean |
stroke.erase? |
boolean |
stroke.families? |
ScatterFamily[] |
stroke.level? |
number |
stroke.lower? |
boolean |
stroke.material? |
string |
stroke.multiplier? |
number |
stroke.points? |
[number, number][] |
stroke.radius? |
number |
stroke.shape? |
"circle" | "square" |
stroke.strength? |
number |
stroke.tool? |
"scatter" | "paint" | "sculpt" | "smooth" | "flatten" |
stroke.where? |
string |
selected? |
readonly number[] |
Returns
Section titled “Returns”TerrainChange