/**************************************************************************

   File:                Point.h

   Author(s):           Pavel Dimitrov

   Created:             11 Jun 2002

   Last Revision:       $Date: 2002/06/27 14:14:40 $

   Description: A basic 2D point.

   $Revision: 1.2 $

   $Log: Point.h,v $
   Revision 1.2  2002/06/27 14:14:40  pdimit
   Just updated the descriptions in the header files.

   Revision 1.1.1.1  2002/06/23 05:42:08  pdimit
   Initial import


	
   Copyright (c) 2002 by Pavel Dimitrov, Centre for Intelligent Machines,
   McGill University, Montreal, QC.  Please see the copyright notice
   included in this distribution for full details.

 **************************************************************************/

#ifndef POINT_H
#  define POINT_H

#include "defines.h"
#include <iostream>
#include <math.h>



namespace sg{
  
  // concrete class
  class Point{
  public:
    double x, y;

    // constructors
    Point() : x(0.0), y(0.0) {}
    Point(double xx, double yy) { x=xx, y=yy;}

    bool operator==(const Point &p) const {
      return x==p.x && y==p.y;
    }

    bool operator!=(const Point &p) const {
      return !operator==(p);
    }

    bool isClose(Point p, double epsilon) {
      return (EUCSQDIST(x,y, p.x,p.y) < (epsilon));
    }

    double distanceToPt(const Point &p) const { 
      return sqrt(EUCSQDIST(x,y,p.x,p.y)); 
    }

    friend std::ostream &operator<< (std::ostream &os, Point &p){
      os << "Pt(" << p.x << ", " << p.y << ")";
      return os;
    }

  }; //end of class Point
  
}

#endif  /* POINT_H */
