lsst.afw  13.0-102-g6486c126f
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 
31  bool isIndeterminate() const { return std::isnan(_g_r); }
32 
34 
44  bool operator==(Color const& other) const {
45  return (isIndeterminate() && other.isIndeterminate()) || other._g_r == _g_r;
46  }
47  bool operator!=(Color const& other) const { return !operator==(other); }
49 
52  double getLambdaEff(Filter const&
53  ) const {
54  return 1000 * _g_r;
55  }
56 
57 private:
58  double _g_r;
59 };
60 }
61 }
62 } // lsst::afw::image
63 
64 #endif
bool operator!=(Color const &other) const
Equality comparison for colors.
Definition: Color.h:47
bool operator==(Color const &other) const
Equality comparison for colors.
Definition: Color.h:44
A base class for image defects.
Definition: cameraGeom.dox:3
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:52
Holds an integer identifier for an LSST filter.
Definition: Filter.h:134
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:31