function distancia(Punto $P) { $dx = $this->x - $P->getX(); $dy = $this->y - $P->getY(); }
/** * @param Punto $p * @return float */ public function distancia(Punto $p) { $dx = $p->getX() - $this->x; $dy = $p->getY() - $this->y; return sqrt(pow($dx, 2) + pow($dy, 2)); }