00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _COLOR_H_
00014 #define _COLOR_H_
00015
00016 #include <iostream>
00017
00018 #include <stdexcept>
00019 #include "General/Types.hh"
00020 #include "General/Debug.hh"
00021 #include "Math/Tuple.hh"
00022
00023
00024 namespace World {
00034 class Color : public Math::Tuple<Double, true, 3> {
00035 public:
00036 enum { R=0, G=1, B=2 };
00038 Color() : Math::Tuple<Double, true, 3>()
00039 {
00040 };
00041
00043 Color(Double r, Double g, Double b);
00044
00046 Color(const Math::Tuple<Double, true, 3> &T) {
00047 D[0] = T[0];
00048 D[1] = T[1];
00049 D[2] = T[2];
00050 }
00051
00053 friend std::ostream &operator<<(std::ostream &os,
00054 const Color &C);
00055 };
00056
00061 namespace ColLib {
00063 inline Color White()
00064 {
00065 return Color(1.0, 1.0, 1.0);
00066 }
00067
00068 inline Color Black()
00069 {
00070 return Color(0.0, 0.0, 0.0);
00071 }
00072
00073 inline Color Red()
00074 {
00075 return Color(1.0, 0.0, 0.0);
00076 }
00077
00078 inline Color Green()
00079 {
00080 return Color(0.0, 1.0, 0.0);
00081 }
00082
00083 inline Color Blue()
00084 {
00085 return Color(0.0, 0.0, 1.0);
00086 }
00087
00088 inline Color Gray()
00089 {
00090 return Color(0.5, 0.5, 0.5);
00091 }
00092
00094 };
00095
00096 }
00097
00098 #endif