dx = $x2 - $x1; $this->dy = $y2 - $y1; $this->length = sqrt($this->dx ** 2 + $this->dy ** 2); $this->bbox = [max($y1, $y2), min($y1, $y2), min($x1, $x2), max($x1, $x2)]; $this->frontSector = $front->sector; } public function setBack(Side $back): void { $this->back = $back; $this->backSector = $back->sector; $this->flags |= self::TWO_SIDED; } /** 0 = front (right) side, 1 = back (P_PointOnLineSide). */ public function side(float $x, float $y): int { return (($x - $this->x1) * $this->dy - ($y - $this->y1) * $this->dx) >= 0 ? 0 : 1; } }