public function isOnSameLine(Vertex $vertex) {
        if (is_null($this->getGradient()) && is_null($vertex->getGradient()) && $this->from->getLongitude() == $vertex->getFrom()->getLongitude()) {
            return true;
        } elseif (!is_null($this->getGradient()) && !is_null($vertex->getGradient())) {
            return (
                bccomp($this->getGradient(), $vertex->getGradient(), $this->getPrecision()) === 0
                &&
                bccomp($this->getOrdinateIntercept(), $vertex->getOrdinateIntercept(), $this->getPrecision()) ===0
            );
        } else {
            return false;
        }
    }