31 lines
1012 B
C#
31 lines
1012 B
C#
namespace RobotNet10.GlobalPathPlanner.Model;
|
|
|
|
/// <summary>
|
|
/// Represents a node in the KD-Tree structure.
|
|
/// Immutable to prevent structural corruption.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Initializes a new KD-Tree node.
|
|
/// </remarks>
|
|
public class KDTreeNode(GlobalNode node, int axis, KDTreeNode? left = null, KDTreeNode? right = null)
|
|
{
|
|
/// <summary>
|
|
/// The spatial node stored at this tree node.
|
|
/// </summary>
|
|
public GlobalNode Node { get; } = node ?? throw new ArgumentNullException(nameof(node));
|
|
|
|
/// <summary>
|
|
/// Left child (contains points with smaller values along the split axis).
|
|
/// </summary>
|
|
public KDTreeNode? Left { get; } = left;
|
|
|
|
/// <summary>
|
|
/// Right child (contains points with larger values along the split axis).
|
|
/// </summary>
|
|
public KDTreeNode? Right { get; } = right;
|
|
|
|
/// <summary>
|
|
/// The axis used for splitting: 0 for X, 1 for Y.
|
|
/// </summary>
|
|
public int Axis { get; } = axis;
|
|
} |