Represents a node in a KD-Tree. Attributes: point: The point stored in this node. left: The left child node. right: The right child node.
| 10 | |
| 11 | |
| 12 | class KDNode: |
| 13 | """ |
| 14 | Represents a node in a KD-Tree. |
| 15 | |
| 16 | Attributes: |
| 17 | point: The point stored in this node. |
| 18 | left: The left child node. |
| 19 | right: The right child node. |
| 20 | """ |
| 21 | |
| 22 | def __init__( |
| 23 | self, |
| 24 | point: list[float], |
| 25 | left: KDNode | None = None, |
| 26 | right: KDNode | None = None, |
| 27 | ) -> None: |
| 28 | """ |
| 29 | Initializes a KDNode with the given point and child nodes. |
| 30 | |
| 31 | Args: |
| 32 | point (list[float]): The point stored in this node. |
| 33 | left (Optional[KDNode]): The left child node. |
| 34 | right (Optional[KDNode]): The right child node. |
| 35 | """ |
| 36 | self.point = point |
| 37 | self.left = left |
| 38 | self.right = right |