ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/lib/prism.cal
Revision: 1.2
Committed: Tue Mar 18 17:30:17 2003 UTC (21 years, 2 months ago) by greg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
State: FILE REMOVED
Log Message:
Decided to move ray/lib directory into non-CVS distribution

File Contents

# User Rev Content
1 greg 1.1 {
2     Calculation of relay directions for prismatic glazing
3    
4     31 July 1991 Greg Ward
5    
6     Prism is oriented with flat side in xz plane
7     and normal in -y direction. The prism is
8     extruded along the x axis.
9    
10     Reflections are not computed.
11    
12     Parameters:
13     A1 - index of refraction
14     A2 - thickness of prism triangle
15     A3 - height of upper side (segment 1)
16     A4 - height of lower side (segment 2)
17    
18     Computes:
19     coef1 - transmission coefficient for upper side
20     dx1, dy1,
21     dz1 - transmission direction for upper side
22     coef2 - transmission coefficient for lower side
23     dx2, dy2,
24     dz2 - transmission direction for lower side
25     }
26     { required formulae }
27     tan2sin(a) = sqrt(a*a/(1+a*a));
28     stb(sta,ca,sa) = ca*sta - sa*sqrt(A1*A1-sta*sta);
29     cos_p = Sqrt(1-Dx*Dx);
30     dtrans(c1,c2) = dtransb(c1, sqrt(1+(c1*c1-1)/A1/A1),
31     c2, sqrt(1+(c2*c2-1)/A1/A1));
32     dtransb(c1o,c1i,c2o,c2i) = 8*A1*A1 *
33     ( c1o*c1i*c2o*c2i/sq((A1*c1o+c1i)*(A1*c2o+c2i)) +
34     1/c1o/c1i/c2o/c2i/sq((A1/c1o+1/c1i)*(A1/c2o+1/c2i)) );
35    
36     {************************************************
37     Definitions for Segment 1
38     }
39     { slope angle (always positive) }
40     sin_a1 = tan2sin(A2/A3/cos_p);
41     cos_a1 = Sqrt(1-sin_a1*sin_a1);
42     { computed coefficeint }
43     coef1 = A3/(A3+A4) * if(Dy,
44     if(1-abs(sin_tB1o),
45     dtrans(cos_tA1i, cos_tB1o),
46     0),
47     if (Dy*cos_a1 + Dz*sin_a1,
48     0,
49     if (1-abs(sin_tA1o),
50     dtrans(cos_tB1i, cos_tA1o),
51     0)));
52     { computed direction }
53     dx1 = Dx;
54     dy1 = if(Dy,
55     (cos_a1*cos_tB1o-sin_a1*sin_tB1o)*cos_p,
56     -cos_tA1o*cos_p);
57     dz1 = if(Dy,
58     (sin_a1*cos_tB1o+cos_a1*sin_tB1o)*cos_p,
59     -sin_tA1o*cos_p);
60     { incident angle (flat side) }
61     sin_tA1i = Dz/cos_p;
62     cos_tA1i = Sqrt(1-sin_tA1i*sin_tA1i);
63     { transmitted angle (steep side) }
64     sin_tB1o = stb(sin_tA1i, cos_a1, sin_a1);
65     cos_tB1o = Sqrt(1-sin_tB1o*sin_tB1o);
66     { incident angle (steep side) }
67     sin_tB1i = -Dz/cos_p*cos_a1 -
68     Sqrt(1-sq(Dz/cos_p))*sin_a1;
69     cos_tB1i = Sqrt(1-sin_tB1i*sin_tB1i);
70     { transmitted angle (flat side) }
71     sin_tA1o = stb(sin_tB1i, cos_a1, -sin_a1);
72     cos_tA1o = Sqrt(1-sin_tA1o*sin_tA1o);
73    
74     {************************************************
75     Definitions for Segment 2
76     }
77     { slope angle (always negative) }
78     sin_a2 = -tan2sin(A2/A4/cos_p);
79     cos_a2 = Sqrt(1-sin_a2*sin_a2);
80     { computed coefficeint }
81     coef2 = A4/(A3+A4) * if(Dy,
82     if(1-abs(sin_tB2o),
83     dtrans(cos_tA2i, cos_tB2o),
84     0),
85     if (Dy*cos_a2 + Dz*sin_a2,
86     0,
87     if (1-abs(sin_tA2o),
88     dtrans(cos_tB2i, cos_tA2o),
89     0)));
90     { computed direction }
91     dx2 = Dx;
92     dy2 = if(Dy,
93     (cos_a2*cos_tB2o-sin_a2*sin_tB2o)*cos_p,
94     -cos_tA2o*cos_p);
95     dz2 = if(Dy,
96     (sin_a2*cos_tB2o+cos_a2*sin_tB2o)*cos_p,
97     -sin_tA2o*cos_p);
98     { incident angle (flat side) }
99     sin_tA2i = Dz/cos_p;
100     cos_tA2i = Sqrt(1-sin_tA2i*sin_tA2i);
101     { transmitted angle (steep side) }
102     sin_tB2o = stb(sin_tA2i, cos_a2, sin_a2);
103     cos_tB2o = Sqrt(1-sin_tB2o*sin_tB2o);
104     { incident angle (steep side) }
105     sin_tB2i = -Dz/cos_p*cos_a2 -
106     Sqrt(1-sq(Dz/cos_p))*sin_a2;
107     cos_tB2i = Sqrt(1-sin_tB2i*sin_tB2i);
108     { transmitted angle (flat side) }
109     sin_tA2o = stb(sin_tB2i, cos_a2, -sin_a2);
110     cos_tA2o = Sqrt(1-sin_tA2o*sin_tA2o);