LSSTApplications  11.0-24-g0a022a1,14.0+77,15.0,15.0+1
LSSTDataManagementBasePackage
Frame.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #ifndef LSST_JOINTCAL_FRAME_H
3 #define LSST_JOINTCAL_FRAME_H
4 
5 #include <iostream>
6 #include "lsst/jointcal/Point.h"
7 
8 namespace lsst {
9 namespace jointcal {
10 
12 
14 
16 
19 class Frame {
20 public:
22  double xMin, xMax, yMin, yMax;
23 
25  Frame();
26 
29  Frame(double xMin, double yMin, double xMax, double yMax);
30 
32  Frame(const Point &lowerLeft, const Point &upperRight);
33 
35  double getWidth() const { return xMax - xMin; }
36 
38  double getHeight() const { return yMax - yMin; }
39 
41  Point getCenter() const { return Point((xMax + xMin) * 0.5, (yMax + yMin) * 0.5); }
42 
44  Frame operator*(const Frame &right) const; /* intersection : a = b n c */
45 
47  Frame &operator*=(const Frame &right); /* intersection : a = a n b */
48 
50  Frame operator+(const Frame &right) const; /* union : a = b u c */
51 
53  Frame &operator+=(const Frame &right); /* intersection : a = a u b */
54 
56  void cutMargin(const double marginSize);
57 
59  void cutMargin(const double marginX, const double marginY);
60 
62  bool operator==(const Frame &right) const;
63 
65  bool operator!=(const Frame &right) const { return !(*this == right); }
66 
68  Frame rescale(const double factor) const;
69 
70  // the area.
71  double getArea() const;
72 
74  bool inFrame(double x, double y) const;
75 
77  bool inFrame(const Point &point) const { return inFrame(point.x, point.y); }
78 
80  double minDistToEdges(const Point &point) const;
81 
82  void dump(std::ostream &stream = std::cout) const;
83 
85  friend std::ostream &operator<<(std::ostream &stream, const Frame &right) {
86  right.dump(stream);
87  return stream;
88  };
89 
90 private:
91  void order();
92 };
93 } // namespace jointcal
94 } // namespace lsst
95 
96 #endif // LSST_JOINTCAL_FRAME_H
bool operator!=(const Frame &right) const
comparison
Definition: Frame.h:65
A point in a plane.
Definition: Point.h:13
double getArea() const
Definition: Frame.cc:102
Frame operator+(const Frame &right) const
union of Frames
Definition: Frame.cc:58
T right(T... args)
void cutMargin(const double marginSize)
shrinks the frame (if marginSize>0), enlarges it (if marginSize<0).
Definition: Frame.cc:92
double xMin
coordinate of boundary.
Definition: Frame.h:22
Frame()
Default constructor.
Definition: Frame.cc:30
Frame rescale(const double factor) const
rescale it. The center does not move.
Definition: Frame.cc:94
double x
coordinate
Definition: Point.h:18
double getHeight() const
size along y axis
Definition: Frame.h:38
rectangle with sides parallel to axes.
Definition: Frame.h:19
void dump(std::ostream &stream=std::cout) const
Definition: Frame.cc:108
A base class for image defects.
Definition: cameraGeom.dox:3
double x
double minDistToEdges(const Point &point) const
distance to closest boundary.
Definition: Frame.cc:33
friend std::ostream & operator<<(std::ostream &stream, const Frame &right)
allows
Definition: Frame.h:85
double getWidth() const
size along x axis
Definition: Frame.h:35
bool inFrame(double x, double y) const
inside?
Definition: Frame.cc:104
Point getCenter() const
Center of the frame.
Definition: Frame.h:41
WhichTransformed
Definition: Frame.h:13
bool inFrame(const Point &point) const
same as above
Definition: Frame.h:77
Frame & operator*=(const Frame &right)
intersection of Frame&#39;s
Definition: Frame.cc:44
bool operator==(const Frame &right) const
necessary for comparisons (!= is defined from this one implicitely)
Definition: Frame.cc:81
Frame operator*(const Frame &right) const
intersection of Frame&#39;s.
Definition: Frame.cc:38
STL class.
Frame & operator+=(const Frame &right)
union of Frames
Definition: Frame.cc:64