Documentation / @interstellar-tools/maps / profileStats
Function: profileStats()
ts
function profileStats(
points: readonly ProfilePointInterface[]
): ProfileStatsInterface;Defined in: terrain/profile.ts:194
A profile's figures: its length, how much it rises from start to end, its highest and lowest points, and its steepest grade.
Notes
- The grade is between neighbouring samples, about a cell apart from profile: it's the slope along the line, which is at most the ground's own slope there.
- Samples with a
NaNheight are left out: of the rise, which runs from the first sample with a height to the last, of the highest and lowest, and of the grades next to them. With none, the rise, highest and lowest areNaN, and the grade 0.
Parameters
| Parameter | Type | Description |
|---|---|---|
points | readonly ProfilePointInterface[] | The profile, as profile or pathProfile give it (at least one sample). |
Returns
Its length, rise, highest and lowest heights, and steepest grade.
Throws
If there are no samples.
Example
ts
profileStats([
{ distance: 0, height: 5 },
{ distance: 10, height: 15 },
{ distance: 20, height: 12 }
]); // length 20, rise 7, highest 15, lowest 5, steepestGrade π/4