src/Maths/Maths.php
public static function areParallels(Line $line1, Line $line2)
    {
        if (
            ($line1->isHorizontal() && $line2->isHorizontal()) ||
            ($line1->isVertical() && $line2->isVertical())
        ) {
            return true;
        }
        $line1->rearrange();
        $line2->rearrange();
        $abs = array(
            $line1->getPointA()->getAbscissa(),
            $line1->getPointB()->getAbscissa(),
            $line2->getPointA()->getAbscissa(),
            $line2->getPointB()->getAbscissa()
        );
        $ords = array(
            $line1->getPointA()->getOrdinate(),
            $line1->getPointB()->getOrdinate(),
            $line2->getPointA()->getOrdinate(),
            $line2->getPointB()->getOrdinate()
        );
        $e = new Point(
            rand(0, 10) + (max($abs) + abs(min($abs))),
            rand(0, 10) + (max($ords) + abs(min($ords)))
        );
        $segAE = new Segment($line1->getPointA(), $e);
        $segBE = new Segment($line1->getPointB(), $e);

        $intersectCE = self::getLinesIntersection($segAE, $line2);
        $segCE = new Segment($intersectCE, $e);
        $intersectDE = self::getLinesIntersection($segBE, $line2);
        $segDE = new Segment($intersectDE, $e);

/*
echo <<<TYPEOTHER
        var demo1 = brd.create('point', [{$line1->getPointA()->x},{$line1->getPointA()->y}], {
            name: 'a'
        });
        var demo2 = brd.create('point', [{$line1->getPointB()->x},{$line1->getPointB()->y}], {
            name: 'b'
        });
        var segment1 = brd.create('line', [demo1,demo2], {straightFirst:false,straightLast:false});

        var demo3 = brd.create('point', [{$intersectCE->x},{$intersectCE->y}], {
            name: 'c'
        });
        var demo4 = brd.create('point', [{$intersectDE->x},{$intersectDE->y}], {
            name: 'd'
        });
        var segment2 = brd.create('line', [demo3,demo4], {straightFirst:false,straightLast:false});

        var demo5 = brd.create('point', [{$e->x},{$e->y}], {
            name: 'e'
        });
        var segment3 = brd.create('line', [demo1,demo5], {straightFirst:false,straightLast:false,color:'#404040'});
        var segment4 = brd.create('line', [demo2,demo5], {straightFirst:false,straightLast:false,color:'#404040'});
        var segment5 = brd.create('line', [demo3,demo5], {straightFirst:false,straightLast:false,color:'#404040'});
        var segment6 = brd.create('line', [demo4,demo5], {straightFirst:false,straightLast:false,color:'#404040'});
TYPEOTHER;
*/

        return (bool) (($segAE->getLength() / $segCE->getLength()) == ($segBE->getLength() / $segDE->getLength()));
    }
public static function areParallels(Line $line1, Line $line2)
    {
        if (
            ($line1->isHorizontal() && $line2->isHorizontal()) ||
            ($line1->isVertical() && $line2->isVertical())
        ) {
            return true;
        }
        $line1->rearrange();
        $line2->rearrange();
        $abs = array(
            $line1->getPointA()->getAbscissa(),
            $line1->getPointB()->getAbscissa(),
            $line2->getPointA()->getAbscissa(),
            $line2->getPointB()->getAbscissa()
        );
        $ords = array(
            $line1->getPointA()->getOrdinate(),
            $line1->getPointB()->getOrdinate(),
            $line2->getPointA()->getOrdinate(),
            $line2->getPointB()->getOrdinate()
        );
        $e = new Point(
            rand(0, 10) + (max($abs) + abs(min($abs))),
            rand(0, 10) + (max($ords) + abs(min($ords)))
        );
        $segAE = new Segment($line1->getPointA(), $e);
        $segBE = new Segment($line1->getPointB(), $e);

        $intersectCE = self::getLinesIntersection($segAE, $line2);
        $segCE = new Segment($intersectCE, $e);
        $intersectDE = self::getLinesIntersection($segBE, $line2);
        $segDE = new Segment($intersectDE, $e);

/*
echo <<<TYPEOTHER
        var demo1 = brd.create('point', [{$line1->getPointA()->x},{$line1->getPointA()->y}], {
            name: 'a'
        });
        var demo2 = brd.create('point', [{$line1->getPointB()->x},{$line1->getPointB()->y}], {
            name: 'b'
        });
        var segment1 = brd.create('line', [demo1,demo2], {straightFirst:false,straightLast:false});

        var demo3 = brd.create('point', [{$intersectCE->x},{$intersectCE->y}], {
            name: 'c'
        });
        var demo4 = brd.create('point', [{$intersectDE->x},{$intersectDE->y}], {
            name: 'd'
        });
        var segment2 = brd.create('line', [demo3,demo4], {straightFirst:false,straightLast:false});

        var demo5 = brd.create('point', [{$e->x},{$e->y}], {
            name: 'e'
        });
        var segment3 = brd.create('line', [demo1,demo5], {straightFirst:false,straightLast:false,color:'#404040'});
        var segment4 = brd.create('line', [demo2,demo5], {straightFirst:false,straightLast:false,color:'#404040'});
        var segment5 = brd.create('line', [demo3,demo5], {straightFirst:false,straightLast:false,color:'#404040'});
        var segment6 = brd.create('line', [demo4,demo5], {straightFirst:false,straightLast:false,color:'#404040'});
TYPEOTHER;
*/

        return (bool) (($segAE->getLength() / $segCE->getLength()) == ($segBE->getLength() / $segDE->getLength()));
    }
Test if two segments are parallels

This will test if the two lines drawn from the two segments verify the Thales theorem
by comparing [ab] (segment 1), [cd] (segment 2) and a fifth point [e] used to build
triangles:

[ae]/[ce] == [be]/[de] ?

@param   \Maths\Geometry\Line     $line1
@param   \Maths\Geometry\Line     $line2
@return  bool