aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorArun Isaac2021-03-15 14:43:22 +0530
committerArun Isaac2021-03-15 14:43:22 +0530
commit8c08eff9dc4a46c9c0fb41330e45f4d0356ecdcb (patch)
tree74fc265173f2b74ee49fad3ed99627f041a5a268 /contrib
parentca09b0fbfe37f8cce391259bff6e2d2892127756 (diff)
downloadnsmc-8c08eff9dc4a46c9c0fb41330e45f4d0356ecdcb.tar.gz
nsmc-8c08eff9dc4a46c9c0fb41330e45f4d0356ecdcb.tar.lz
nsmc-8c08eff9dc4a46c9c0fb41330e45f4d0356ecdcb.zip
Fix solid_angle_fraction2planar_angle for solid_angle_fraction > 1/2.
* contrib/cone-vector.py (solid_angle_fraction2planar_angle): Fix for solid_angle_fraction > 1/2.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/cone-vector.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/contrib/cone-vector.py b/contrib/cone-vector.py
index 6526817..85c2c49 100644
--- a/contrib/cone-vector.py
+++ b/contrib/cone-vector.py
@@ -38,10 +38,9 @@ def solid_angle_fraction2planar_angle (solid_angle_fraction, dim):
alpha = (dim - 1) / 2
beta = 1/2
if solid_angle_fraction < 1/2:
- planar_angle = betaincinv(alpha, beta, 2*solid_angle_fraction)
+ return arcsin(sqrt(betaincinv(alpha, beta, 2*solid_angle_fraction)))
else:
- planar_angle = betaincinv(alpha, beta, 2*(1-solid_angle_fraction))
- return arcsin(sqrt(planar_angle))
+ return pi - arcsin(sqrt(betaincinv(alpha, beta, 2*(1-solid_angle_fraction))))
def rotate_from_nth_canonical (x, axis):
xn = x[-1]