/**
* Returns true if the vertex passed on argument is on the same line as this object
*
* @param Vertex $vertex The vertex to compare
* @return boolean
*/
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;
}
}