LSSTApplications  16.0-10-g4f78f78+16,16.0-10-gc1446dd+42,16.0-11-g09ed895+1,16.0-13-g7649090,16.0-14-g0a28612+1,16.0-14-g6c7ed55+16,16.0-15-ga29f190+1,16.0-16-g89065d4+14,16.0-16-gd8e3590+16,16.0-16-ge6a35c8+6,16.0-17-g7e0e4ff+10,16.0-17-ga3d2e9f,16.0-19-gb830ed4e+16,16.0-2-g0febb12+21,16.0-2-g9d5294e+61,16.0-2-ga8830df+5,16.0-24-gc1c7f52+9,16.0-25-g07af9f2+1,16.0-3-ge00e371+21,16.0-36-g07840cb1,16.0-4-g18f3627+5,16.0-4-g5f3a788+20,16.0-4-ga3eb747+10,16.0-4-gabf74b7+16,16.0-4-gade8416+9,16.0-4-gb13d127+5,16.0-5-g6a53317+21,16.0-5-gb3f8a4b+74,16.0-5-gef99c9f+12,16.0-6-g9321be7+4,16.0-6-gcbc7b31+22,16.0-6-gf49912c+16,16.0-63-gae20905ba,16.0-7-gd2eeba5+31,16.0-8-g21fd5fe+16,16.0-8-g3a9f023+12,16.0-8-g4734f7a,16.0-9-g85d1a16+16,16.0-9-gf5c1f43,master-g07ce7b41a7,w.2018.48
LSSTDataManagementBasePackage
Point.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 /*
3  * This file is part of jointcal.
4  *
5  * Developed for the LSST Data Management System.
6  * This product includes software developed by the LSST Project
7  * (https://www.lsst.org).
8  * See the COPYRIGHT file at the top-level directory of this distribution
9  * for details of code ownership.
10  *
11  * This program is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef LSST_JOINTCAL_POINT_H
26 #define LSST_JOINTCAL_POINT_H
27 #include <iostream>
28 #include <cmath>
29 
30 namespace lsst {
31 namespace jointcal {
32 
35 class Point {
37 public:
38  virtual ~Point() {}
39 
41  double x, y;
42 
44  Point() : x(0), y(0){};
45 
47  Point(double xx, double yy) : x(xx), y(yy){};
48 
50  double Distance(const Point& other) const {
51  return sqrt((x - other.x) * (x - other.x) + (y - other.y) * (y - other.y));
52  };
53 
55  double computeDist2(const Point& other) const {
56  return ((x - other.x) * (x - other.x) + (y - other.y) * (y - other.y));
57  };
58 
60  Point operator+(const Point& Right) const { return Point(x + Right.x, y + Right.y); }
61 
63  Point operator-(const Point& Right) const { return Point(x - Right.x, y - Right.y); }
64 
66  virtual void dump(std::ostream& s = std::cout) const { s << "x: " << x << " y: " << y; }
67 
69  friend std::ostream& operator<<(std::ostream& stream, const Point& point) {
70  point.dump(stream);
71  return stream;
72  }
73 };
74 
76 } // namespace jointcal
77 } // namespace lsst
78 
79 #endif // LSST_JOINTCAL_POINT_H
A point in a plane.
Definition: Point.h:36
virtual void dump(std::ostream &s=std::cout) const
utility
Definition: Point.h:66
double Distance(const Point &other) const
Definition: Point.h:50
double x
coordinate
Definition: Point.h:41
A base class for image defects.
Definition: cameraGeom.dox:3
Point(double xx, double yy)
Definition: Point.h:47
virtual ~Point()
Definition: Point.h:38
solver_t * s
Point operator+(const Point &Right) const
Sum.
Definition: Point.h:60
double computeDist2(const Point &other) const
distance squared to other
Definition: Point.h:55
ItemVariant const * other
Definition: Schema.cc:56
T sqrt(T... args)
Point operator-(const Point &Right) const
Difference.
Definition: Point.h:63
STL class.
friend std::ostream & operator<<(std::ostream &stream, const Point &point)
Definition: Point.h:69