HeightMap: add threshold operations that return new HeightMaps (closes #197)
Add three methods that create NEW HeightMap objects: - threshold(range): preserve original values where in range, 0.0 elsewhere - threshold_binary(range, value=1.0): set uniform value where in range - inverse(): return (1.0 - value) for each cell These operations are immutable - they preserve the original HeightMap. Useful for masking operations with Grid.apply_threshold/apply_ranges. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b98b2be012
commit
d92d5f0274
3 changed files with 463 additions and 0 deletions
|
|
@ -40,6 +40,11 @@ public:
|
|||
static PyObject* min_max(PyHeightMapObject* self, PyObject* Py_UNUSED(args));
|
||||
static PyObject* count_in_range(PyHeightMapObject* self, PyObject* args);
|
||||
|
||||
// Threshold operations (#197) - return NEW HeightMaps
|
||||
static PyObject* threshold(PyHeightMapObject* self, PyObject* args);
|
||||
static PyObject* threshold_binary(PyHeightMapObject* self, PyObject* args, PyObject* kwds);
|
||||
static PyObject* inverse(PyHeightMapObject* self, PyObject* Py_UNUSED(args));
|
||||
|
||||
// Subscript support for hmap[x, y] syntax
|
||||
static PyObject* subscript(PyHeightMapObject* self, PyObject* key);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue