src/Maths/Geometry/Line.php
public function rearrange($direction = Maths::DIRECTION_POSITIVE)
    {
        $a = $this->getPointA();
        $b = $this->getPointB();
        $directions = Maths::getDirectionByPoints($a, $b);
        if ($directions[0]!=$direction) {
            $this->setPointA($b);
            $this->setPointB($a);
        }
        return $this;
    }
public function rearrange($direction = Maths::DIRECTION_POSITIVE)
    {
        $a = $this->getPointA();
        $b = $this->getPointB();
        $directions = Maths::getDirectionByPoints($a, $b);
        if ($directions[0]!=$direction) {
            $this->setPointA($b);
            $this->setPointB($a);
        }
        return $this;
    }
Rearrange a segment to have [A->B] in requested direction

@param   int     $direction
@return  $this