HeightMap: add query methods (closes #196)

Add methods to query HeightMap values and statistics:
- get(pos): Get height value at integer coordinates
- get_interpolated(pos): Get bilinearly interpolated height at float coords
- get_slope(pos): Get slope angle (0 to pi/2) at position
- get_normal(pos, water_level): Get surface normal vector
- min_max(): Get (min, max) tuple of all values
- count_in_range(range): Count cells with values in range

All methods include proper bounds checking and error messages.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John McCardle 2026-01-11 20:42:33 -05:00
commit 8d6d564d6b
3 changed files with 468 additions and 0 deletions

View file

@ -32,6 +32,14 @@ public:
static PyObject* clamp(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
static PyObject* normalize(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
// Query methods (#196)
static PyObject* get(PyHeightMapObject* self, PyObject* args);
static PyObject* get_interpolated(PyHeightMapObject* self, PyObject* args);
static PyObject* get_slope(PyHeightMapObject* self, PyObject* args);
static PyObject* get_normal(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
static PyObject* min_max(PyHeightMapObject* self, PyObject* Py_UNUSED(args));
static PyObject* count_in_range(PyHeightMapObject* self, PyObject* args);
// Method and property definitions
static PyMethodDef methods[];
static PyGetSetDef getsetters[];