 Timestamp:
 Jan 7, 2013, 1:42:03 PM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/image/color/cie1931.cpp
r2206 r2207 47 47 float Cp_ = 0.5f * (Cp1 + Cp2); 48 48 49 float hp1 = fmod(atan2(lab1.z, ap1) + 2.f * pi, 2.f * pi); 50 float hp2 = fmod(atan2(lab2.z, ap2) + 2.f * pi, 2.f * pi); 51 float dhp; /* pi .. pi */ 52 if (abs(hp1  hp2) <= pi) 53 dhp = hp2  hp1; 54 else if (hp2 <= hp1) 55 dhp = hp2  hp1 + 2.f * pi; 56 else 57 dhp = hp2  hp1  2.f * pi; 58 float dHp = 2.f * sqrt(Cp1 * Cp2) * sin(dhp / 2.f); 59 float Hp_; /* halfangle 0 .. 360 */ 60 if (!(Cp1 * Cp2)) 61 Hp_ = hp1 + hp2; 62 else if (abs(hp1  hp2) > pi && hp1 + hp2 < 2.f * pi) 63 Hp_ = 0.5f * (hp1 + hp2) + pi; 64 else if (abs(hp1  hp2) > pi) 65 Hp_ = 0.5f * (hp1 + hp2)  pi; 66 else 67 Hp_ = 0.5f * (hp1 + hp2); 49 float hp1 = atan2(lab1.z, ap1); 50 float hp2 = atan2(lab2.z, ap2); 51 float dhp = fmod(hp2  hp1 + 3.f * pi, 2.f * pi)  pi; /* pi .. pi */ 52 float dHp = 2.f * sqrt(Cp1 * Cp2) * sin(0.5f * dhp); 53 float Hp_ = Cp1 * Cp2 ? fmod(hp1 + 0.5f * dhp + 2.f * pi, 2.f * pi) : hp1 + hp2; /* 0 .. 2pi */ 68 54 69 55 float T = 1.f  0.17f * cos(Hp_  pi / 6.f)
Note: See TracChangeset
for help on using the changeset viewer.