From 8ee2a234ec9d5a7da4840d31dfda05073413bb80 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 29 Jan 2025 12:45:39 +0000 Subject: [PATCH] posts: kd-tree: fix typing --- content/posts/2024-08-10-kd-tree/index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/posts/2024-08-10-kd-tree/index.md b/content/posts/2024-08-10-kd-tree/index.md index 3135647..2863201 100644 --- a/content/posts/2024-08-10-kd-tree/index.md +++ b/content/posts/2024-08-10-kd-tree/index.md @@ -298,7 +298,7 @@ class AABB(NamedTuple): ) # Extend a box to contain a given point - def extend(self, point: Point) -> None: + def extend(self, point: Point) -> AABB: low = NamedTuple(*(map(min, zip(self.low, point)))) high = NamedTuple(*(map(max, zip(self.high, point)))) return AABB(low, high) @@ -392,7 +392,7 @@ class MaxHeap[T]: return heapq.heappop(self._heap).value # Pushes a value onto the heap, pops and returns the highest value - def pushpop(self, value: T) -> None: + def pushpop(self, value: T) -> T: return heapq.heappushpop(self._heap, Reverse(value)).value ``` @@ -452,7 +452,7 @@ class KdSplitNode[T]: def closest( self, point: Point, - out: list[ClosestPoint[T]], + out: MaxHeap[ClosestPoint[T]], n: int, bounds: AABB, ) -> None: