예제 #1
0
 function distancia(Punto $P)
 {
     $dx = $this->x - $P->getX();
     $dy = $this->y - $P->getY();
 }
예제 #2
0
 /**
  * @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));
 }