LSSTApplications  11.0-24-g0a022a1,14.0+77,15.0,15.0+1
LSSTDataManagementBasePackage
Point.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #ifndef LSST_JOINTCAL_POINT_H
3 #define LSST_JOINTCAL_POINT_H
4 #include <iostream>
5 #include <cmath>
6 
7 namespace lsst {
8 namespace jointcal {
9 
12 class Point {
14 public:
15  virtual ~Point() {}
16 
18  double x, y;
19 
21  Point() : x(0), y(0){};
22 
24  Point(double xx, double yy) : x(xx), y(yy){};
25 
27  double Distance(const Point& other) const {
28  return sqrt((x - other.x) * (x - other.x) + (y - other.y) * (y - other.y));
29  };
30 
32  double computeDist2(const Point& other) const {
33  return ((x - other.x) * (x - other.x) + (y - other.y) * (y - other.y));
34  };
35 
37  Point operator+(const Point& Right) const { return Point(x + Right.x, y + Right.y); }
38 
40  Point operator-(const Point& Right) const { return Point(x - Right.x, y - Right.y); }
41 
43  virtual void dump(std::ostream& s = std::cout) const { s << " x " << x << " y " << y; }
44 
46  friend std::ostream& operator<<(std::ostream& stream, const Point& point) {
47  point.dump(stream);
48  return stream;
49  }
50 };
51 
53 } // namespace jointcal
54 } // namespace lsst
55 
56 #endif // LSST_JOINTCAL_POINT_H
solver_t * s
A point in a plane.
Definition: Point.h:13
virtual void dump(std::ostream &s=std::cout) const
utility
Definition: Point.h:43
double Distance(const Point &other) const
Definition: Point.h:27
double x
coordinate
Definition: Point.h:18
A base class for image defects.
Definition: cameraGeom.dox:3
Point(double xx, double yy)
Definition: Point.h:24
virtual ~Point()
Definition: Point.h:15
Point operator+(const Point &Right) const
Sum.
Definition: Point.h:37
double computeDist2(const Point &other) const
distance squared to other
Definition: Point.h:32
T sqrt(T... args)
Point operator-(const Point &Right) const
Difference.
Definition: Point.h:40
STL class.
friend std::ostream & operator<<(std::ostream &stream, const Point &point)
Definition: Point.h:46