ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/spharm.cal
(Generate patch)

Comparing ray/src/cal/cal/spharm.cal (file contents):
Revision 1.1 by greg, Wed Feb 9 17:27:51 2005 UTC vs.
Revision 1.4 by greg, Thu Feb 10 04:53:20 2005 UTC

# Line 1 | Line 1
1 + { RCSid $Id$ }
2   {
3          The first few Spherical Harmonics
4  
# Line 57 | Line 58 | LegendreP2(n,m,x,s) : select(n+1,
58   odd(n) : .5*n - floor(.5*n) - .25;
59   LegendreP(n,m,x) : if(m+.5,
60                  LegendreP2(n,m,x,sqrt(1-x*x)),
61 <                if(odd(-m),-1,1)*fact(n+m)/fact(n-m) *
61 <                        LegendreP2(n,-m,x,sqrt(1-x*x))
61 >                fact(n+m)/fact(n-m) * LegendreP2(n,-m,x,sqrt(1-x*x))
62                  );
63                                          { SH normalization factor }
64   SHnormF(l,m) : sqrt(0.25/PI*(2*l+1)*fact(l-m)/fact(l+m));
# Line 71 | Line 71 | SphericalHarmonicYr(l,m,theta,phi) : SHthetaF(l,m,thet
71   SphericalHarmonicYi(l,m,theta,phi) : SHthetaF(l,m,theta)*sin(m*phi);
72  
73                                          { Ordered, real SH basis functions }
74 + { Coeff. order based on Basri & Jacobs paper, "Lambertian Reflectance and
75 +        Linear Subspaces," IEEE Trans. on Pattern Analysis & Machine Intel.,
76 +        vol. 25, no. 2, Feb. 2003, pp. 218-33, Eq. (7):
77 +
78 +        i       n       m       even/odd
79 +        =       =       =       ========
80 +        1       0       0       x
81 +        2       1       0       x
82 +        3       1       1       e
83 +        4       1       1       o
84 +        5       2       0       x
85 +        6       2       1       e
86 +        7       2       1       o
87 +        8       2       2       e
88 +        9       2       2       o
89 +        10      3       0       x
90 +        11      3       1       e
91 +        ...
92 + }
93   SH_B4(l,m,o,theta,phi) : if(m-.5, if(o, SphericalHarmonicYi(l,m,theta,phi),
94                                          SphericalHarmonicYr(l,m,theta,phi)),
95                                  SHthetaF(l,0,theta) );
# Line 78 | Line 97 | SH_B3(l,r,theta,phi) : SH_B4(l,floor((r+1.00001)/2),od
97   SH_B2(l,i,theta,phi) : SH_B3(l,i-l*l-1,theta,phi);
98   SphericalHarmonicB(i,theta,phi) : SH_B2(ceil(sqrt(i)-1.00001),i,theta,phi);
99  
100 <                                        { Application of SH fitting coeff. f(i) }
100 >                                        { Application of SH coeff. f(i) }
101   SH_F2(n,f,theta,phi) : if(n-.5, f(n)*SphericalHarmonicB(n,theta,phi) +
102                                  SH_F2(n-1,f,theta,phi), 0);
103   SphericalHarmonicF(f,theta,phi) : SH_F2(f(0),f,theta,phi);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines