[Proc Gen] HeightMap - Combination operations #194

Open
opened 2026-01-12 00:07:45 +00:00 by john · 0 comments
Owner

Parent Issue: #192

Overview

Add methods to combine two HeightMaps cell-by-cell.

Specification

All operations mutate in place and return self. Both HeightMaps must have the same size.

def add(self, other: HeightMap) -> HeightMap
def subtract(self, other: HeightMap) -> HeightMap
def multiply(self, other: HeightMap) -> HeightMap
def lerp(self, other: HeightMap, t: float) -> HeightMap
def copy_from(self, other: HeightMap) -> HeightMap
def max(self, other: HeightMap) -> HeightMap  # Per-cell maximum
def min(self, other: HeightMap) -> HeightMap  # Per-cell minimum

Implementation Notes

  • Maps to TCOD_heightmap_add, TCOD_heightmap_multiply, TCOD_heightmap_lerp, TCOD_heightmap_copy
  • subtract, max, min are simple cell-by-cell loops
  • Raise ValueError if sizes don't match

Acceptance Criteria

  • All combination operations work correctly
  • Size mismatch raises ValueError
  • multiply can be used for masking (multiplying by 0/1 values)
  • Unit tests for each operation
**Parent Issue:** #192 ## Overview Add methods to combine two HeightMaps cell-by-cell. ## Specification All operations mutate in place and return `self`. Both HeightMaps must have the same size. ```python def add(self, other: HeightMap) -> HeightMap def subtract(self, other: HeightMap) -> HeightMap def multiply(self, other: HeightMap) -> HeightMap def lerp(self, other: HeightMap, t: float) -> HeightMap def copy_from(self, other: HeightMap) -> HeightMap def max(self, other: HeightMap) -> HeightMap # Per-cell maximum def min(self, other: HeightMap) -> HeightMap # Per-cell minimum ``` ## Implementation Notes - Maps to `TCOD_heightmap_add`, `TCOD_heightmap_multiply`, `TCOD_heightmap_lerp`, `TCOD_heightmap_copy` - `subtract`, `max`, `min` are simple cell-by-cell loops - Raise `ValueError` if sizes don't match ## Acceptance Criteria - [ ] All combination operations work correctly - [ ] Size mismatch raises `ValueError` - [ ] `multiply` can be used for masking (multiplying by 0/1 values) - [ ] Unit tests for each operation
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#194
No description provided.