[Proc Gen] HeightMap - Query methods #196

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

Parent Issue: #192

Overview

Add methods to query HeightMap values and statistics.

Specification

def get(self, pos: tuple[int, int]) -> float
def get_interpolated(self, pos: tuple[float, float]) -> float
def get_slope(self, pos: tuple[int, int]) -> float
def get_normal(self, pos: tuple[int, int]) -> tuple[float, float, float]
def min_max(self) -> tuple[float, float]
def count_in_range(self, range: tuple[float, float]) -> int

Implementation Notes

  • get maps to TCOD_heightmap_get_value
  • get_interpolated maps to TCOD_heightmap_get_interpolated_value
  • get_slope maps to TCOD_heightmap_get_slope (returns 0 to π/2)
  • get_normal maps to TCOD_heightmap_get_normal
  • min_max maps to TCOD_heightmap_get_minmax
  • count_in_range maps to TCOD_heightmap_count_cells
  • pos accepts tuple, list, or mcrfpy.Vector

Acceptance Criteria

  • All query methods return correct values
  • get with out-of-bounds position raises IndexError
  • min_max returns correct extremes after operations
  • Unit tests verify mathematical correctness
**Parent Issue:** #192 ## Overview Add methods to query HeightMap values and statistics. ## Specification ```python def get(self, pos: tuple[int, int]) -> float def get_interpolated(self, pos: tuple[float, float]) -> float def get_slope(self, pos: tuple[int, int]) -> float def get_normal(self, pos: tuple[int, int]) -> tuple[float, float, float] def min_max(self) -> tuple[float, float] def count_in_range(self, range: tuple[float, float]) -> int ``` ## Implementation Notes - `get` maps to `TCOD_heightmap_get_value` - `get_interpolated` maps to `TCOD_heightmap_get_interpolated_value` - `get_slope` maps to `TCOD_heightmap_get_slope` (returns 0 to π/2) - `get_normal` maps to `TCOD_heightmap_get_normal` - `min_max` maps to `TCOD_heightmap_get_minmax` - `count_in_range` maps to `TCOD_heightmap_count_cells` - `pos` accepts tuple, list, or `mcrfpy.Vector` ## Acceptance Criteria - [ ] All query methods return correct values - [ ] `get` with out-of-bounds position raises `IndexError` - [ ] `min_max` returns correct extremes after operations - [ ] Unit tests verify mathematical correctness
john closed this issue 2026-01-12 01:42:56 +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#196
No description provided.