Sign in
EN
games/doom-jumphp / src / Engine / Map / Node.php · commit 8e1cb9f
<?phpnamespace App\Engine\Map;/** * A BSP node (node_t): the partition line, the bounding boxes [top, bottom, left, right] of both children, * children ids: >= 0 a node, < 0 a subsector (-1 - index). */final class Node{    public array $bbox = [[0, 0, 0, 0], [0, 0, 0, 0]];    public array $children = [0, 0];    public function __construct(public float $x, public float $y, public float $dx, public float $dy)    {    }    /** 0 = front (right of the partition), 1 = back. */    public function side(float $x, float $y): int    {        return (($x - $this->x) * $this->dy - ($y - $this->y) * $this->dx) >= 0 ? 0 : 1;    }}