Compare commits

...

3 commits

Author SHA1 Message Date
f15aa0567e posts: kd-tree-revisited: fix typing
All checks were successful
ci/woodpecker/cron/deploy/2 Pipeline was successful
ci/woodpecker/push/deploy/2 Pipeline was successful
ci/woodpecker/manual/deploy/2 Pipeline was successful
2025-01-29 12:45:50 +00:00
8ee2a234ec posts: kd-tree: fix typing 2025-01-29 12:45:50 +00:00
b7a405332c posts: kd-tree-revisited: fix title 2025-01-29 12:44:20 +00:00
2 changed files with 5 additions and 5 deletions

View file

@ -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:

View file

@ -1,5 +1,5 @@
---
title: "Kd Tree Revisited"
title: "k-d Tree Revisited"
date: 2024-08-17T14:20:22+01:00
draft: false # I don't care for draft mode, git has branches for that
description: "Simplifying the nearest neighbour search"
@ -92,7 +92,7 @@ class KdSplitNode[T]:
def closest(
self,
point: Point,
out: list[ClosestPoint[T]],
out: MaxHeap[ClosestPoint[T]],
n: int,
projection: Point,
) -> None: