lsst.afw  14.0-58-g91bfccb15
Color.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * Capture the colour of an object
4  */
5 
6 #ifndef LSST_AFW_IMAGE_COLOR_H
7 #define LSST_AFW_IMAGE_COLOR_H
8 
9 #include <cmath>
10 #include <limits>
11 #include "lsst/afw/image/Filter.h"
12 
13 namespace lsst {
14 namespace afw {
15 namespace image {
16 
26 class Color {
27 public:
28  explicit Color(double g_r = std::numeric_limits<double>::quiet_NaN()) : _g_r(g_r) {}
29 
30  Color(Color const &) = default;
31  Color(Color &&) = default;
32  Color &operator=(Color const &) = default;
33  Color &operator=(Color &&) = default;
34  ~Color() = default;
35 
37  bool isIndeterminate() const { return std::isnan(_g_r); }
38 
40 
50  bool operator==(Color const& other) const {
51  return (isIndeterminate() && other.isIndeterminate()) || other._g_r == _g_r;
52  }
53  bool operator!=(Color const& other) const { return !operator==(other); }
55 
58  double getLambdaEff(Filter const&
59  ) const {
60  return 1000 * _g_r;
61  }
62 
63 private:
64  double _g_r;
65 };
66 }
67 }
68 } // lsst::afw::image
69 
70 #endif
Color & operator=(Color const &)=default
bool operator!=(Color const &other) const
Equality comparison for colors.
Definition: Color.h:53
bool operator==(Color const &other) const
Equality comparison for colors.
Definition: Color.h:50
A base class for image defects.
Color(double g_r=std::numeric_limits< double >::quiet_NaN())
Definition: Color.h:28
double getLambdaEff(Filter const &) const
Return the effective wavelength for this object in the given filter.
Definition: Color.h:58
Holds an integer identifier for an LSST filter.
Definition: Filter.h:141
T isnan(T... args)
Describe the colour of a source.
Definition: Color.h:26
bool isIndeterminate() const
Whether the color is the special value that indicates that it is unspecified.
Definition: Color.h:37