Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: C++  |  size: 0.35 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #define EPS 1e-8
  2. #define PI acos(-1)
  3. #define Vector Point
  4.  
  5. struct Point
  6. {
  7.     double x, y;
  8.     Point(){}
  9.     Point(double a, double b) { x = a; y = b; }
  10.     double mod2() { return x*x + y*y; }
  11.     double mod()  { return sqrt(x*x + y*y); }
  12.     Point ort()   { return Point(-y, x); }
  13.     Point unit()  { double k = mod(); return Point(x/k, y/k); }
  14. };