[Proc Gen] HeightMap - Threshold operations #197

Closed
opened 2026-01-12 00:07:54 +00:00 by john · 0 comments
Owner

Parent Issue: #192

Overview

Add threshold operations that return new HeightMap objects, preserving the original.

Specification

def threshold(self, range: tuple[float, float]) -> HeightMap

Return new HeightMap with original values where in range, 0.0 elsewhere.

def threshold_binary(self, range: tuple[float, float], value: float = 1.0) -> HeightMap

Return new HeightMap with value where in range, 0.0 elsewhere.

def inverse(self) -> HeightMap

Return new HeightMap with (1.0 - value) for each cell.

Implementation Notes

  • These create NEW HeightMaps (unlike scalar/combination ops which mutate)
  • threshold preserves original values for gradient operations (ColorLayer lerp)
  • threshold_binary is for pure masking
  • Range is inclusive: min <= value <= max

Acceptance Criteria

  • threshold returns new HeightMap, original unchanged
  • Values in range are preserved, values outside become 0.0
  • threshold_binary sets uniform value in range
  • inverse correctly inverts all values
  • Unit tests verify immutability of original
**Parent Issue:** #192 ## Overview Add threshold operations that return **new** HeightMap objects, preserving the original. ## Specification ```python def threshold(self, range: tuple[float, float]) -> HeightMap ``` Return new HeightMap with original values where in range, 0.0 elsewhere. ```python def threshold_binary(self, range: tuple[float, float], value: float = 1.0) -> HeightMap ``` Return new HeightMap with `value` where in range, 0.0 elsewhere. ```python def inverse(self) -> HeightMap ``` Return new HeightMap with `(1.0 - value)` for each cell. ## Implementation Notes - These create NEW HeightMaps (unlike scalar/combination ops which mutate) - `threshold` preserves original values for gradient operations (ColorLayer lerp) - `threshold_binary` is for pure masking - Range is inclusive: `min <= value <= max` ## Acceptance Criteria - [ ] `threshold` returns new HeightMap, original unchanged - [ ] Values in range are preserved, values outside become 0.0 - [ ] `threshold_binary` sets uniform value in range - [ ] `inverse` correctly inverts all values - [ ] Unit tests verify immutability of original
john closed this issue 2026-01-12 02:49:47 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
john/McRogueFace#197
No description provided.