空の色(青空と夕焼け)のRGB値の簡易計算

2006.1.25
By Takuichi Hirano (Tokyo Institute of Technology)

レイリー散乱では散乱エネルギーは周波数の4乗に比例することから、空の色を簡易的に計算する。

<参考文献>
[1] ファインマン・レイトン・サンズ:“ファインマン物理学II 光 熱 波動”、岩波書店、2002.

青空

In[8]:=

c = 2.998 * 10^8 ;

λR = 700 * 10^(-9) ;

λG = 500 * 10^(-9) ;

λB = 430 * 10^(-9) ;

freqR = c/λR ;

freqG = c/λG ;

freqB = c/λB ;

In[15]:=

maxFreq = Max[freqR, freqG, freqB] ;

r = (freqR/maxFreq)^4 ;

g = (freqG/maxFreq)^4 ;

b = (freqB/maxFreq)^4 ;

Print["(R,G,B)=(", r, ",", g, ",", b, ")"] ;

m = 255 ;

Print["(R,G,B)=(", Round[r * m], ",", Round[g * m], ",", Round[b * m], ")"] ;

(R,G,B)=(0.142391, 0.547008, 1.)

(R,G,B)=(36, 139, 255)

In[22]:=

Show[Graphics[{RGBColor[r, g, b], Rectangle[{0, 0}, {1, 1}]}]]

[Graphics:HTMLFiles/index_18.gif]

Out[22]=

-Graphics -

赤い夕焼け

In[23]:=

i0 = 1 ;

imax = Max[i0 - r, i0 - g, i0 - b] ;

r2 = (i0 - r)/imax ;

g2 = (i0 - g)/imax ;

b2 = (i0 - b)/imax ;

Print["(R,G,B)=(", r2, ",", g2, ",", b2, ")"] ;

Print["(R,G,B)=(", Round[r2 * m], ",", Round[g2 * m], ",", Round[b2 * m], ")"] ;

Show[Graphics[{RGBColor[r2, g2, b2], Rectangle[{0, 0}, {1, 1}]}]]

(R,G,B)=(1., 0.528203, 0.)

(R,G,B)=(255, 135, 0)

[Graphics:HTMLFiles/index_30.gif]

Out[30]=

-Graphics -


Created by Mathematica  (January 25, 2006) Valid XHTML 1.1!