150 |
|
|
151 |
|
{ Normal distribution from uniform range (0,1) } |
152 |
|
|
153 |
< |
un2`P(t) : t - (2.515517+t*(.802853+t*.010328))/ |
153 |
> |
un2`P.(t) : t - (2.515517+t*(.802853+t*.010328))/ |
154 |
|
(1+t*(1.432788+t*(.189269+t*.001308))) ; |
155 |
< |
un1`P(p) : un2`P(sqrt(-2*log(p))) ; |
155 |
> |
un1`P.(p) : un2`P.(sqrt(-2*log(p))) ; |
156 |
|
|
157 |
< |
unif2norm(p) : if( .5-p, -un1`P(p), un1`P(1-p) ) ; |
157 |
> |
unif2norm(p) : if( .5-p, -un1`P.(p), un1`P.(1-p) ) ; |
158 |
|
|
159 |
|
nrand(x) = unif2norm(rand(x)); |
160 |
|
|
161 |
|
{ Local (u,v) coordinates for planar surfaces } |
162 |
< |
crosslen`P = Nx*Nx + Ny*Ny; |
162 |
> |
crosslen`P. = Nx*Nx + Ny*Ny; |
163 |
|
{ U is distance from projected Z-axis } |
164 |
< |
U = if( crosslen`P - FTINY, |
165 |
< |
(Py*Nx - Px*Ny)/crosslen`P, |
164 |
> |
U = if( crosslen`P. - FTINY, |
165 |
> |
(Py*Nx - Px*Ny)/crosslen`P., |
166 |
|
Px); |
167 |
|
{ V is defined so that N = U x V } |
168 |
< |
V = if( crosslen`P - FTINY, |
169 |
< |
Pz - Nz*(Px*Nx + Py*Ny)/crosslen`P, |
168 |
> |
V = if( crosslen`P. - FTINY, |
169 |
> |
Pz - Nz*(Px*Nx + Py*Ny)/crosslen`P., |
170 |
|
Py); |