aboutsummaryrefslogtreecommitdiff
path: root/contrib/cone-vector.py
AgeCommit message (Collapse)Author
2021-03-19Demonstrate cone sampling with rejection sampling too.Arun Isaac
* contrib/cone-vector.py (sample_code): Demonstrate cone sampling with rejection sampling too.
2021-03-19Implement rejection sampling based cone sampling.Arun Isaac
* contrib/cone-vector.py: Import log. (random_planar_angle_pdf, random_vector_on_spherical_cap_pdf): New functions.
2021-03-19Factor out random planar angle generation.Arun Isaac
* contrib/cone-vector.py (random_planar_angle_cdf, random_vector_on_disk): New functions. (random_vector_on_spherical_cap): Rename to random_vector_on_spherical_cap_cdf. Call random_planar_angle_cdf and random_vector_on_disk. (sample_code): Call random_vector_on_spherical_cap_cdf instead of random_vector_on_spherical_cap.
2021-03-15Put sample code in separate function.Arun Isaac
* contrib/cone-vector.py: Call sample_code when run as a script. (sample_code): New function.
2021-03-15Remove unused imports.Arun Isaac
* contrib/cone-vector.py: Don't import zeros from numpy and gamma from scipy.special.
2021-03-15Add function docstrings.Arun Isaac
* contrib/cone-vector.py (random_vector_on_sphere, planar_angle2solid_angle_fraction, solid_angle_fraction2planar_angle, rotate_from_nth_canonical, random_vector_on_spherical_cap): Add docstrings.
2021-03-15Remove space between function name and bracket.Arun Isaac
* contrib/cone-vector.py (random_vector_on_sphere, planar_angle2solid_angle_fraction, solid_angle_fraction2planar_angle, rotate_from_nth_canonical, random_vector_on_spherical_cap): Remove space between function name and bracket.
2021-03-15Implement simplified cone sampling algorithm.Arun Isaac
* contrib/cone-vector.py: Don't import tan. (random_vector_on_spherical_cap): Implement simplified algorithm that directly samples the surface of the sphere instead of sampling a disk and projecting it onto the surface.
2021-03-15Vectorize functions.Arun Isaac
* contrib/cone-vector.py: Import where. (planar_angle2solid_angle_fraction, solid_angle_fraction2planar_angle): Vectorize functions.
2021-03-15Fix solid_angle_fraction2planar_angle for solid_angle_fraction > 1/2.Arun Isaac
* contrib/cone-vector.py (solid_angle_fraction2planar_angle): Fix for solid_angle_fraction > 1/2.
2021-03-10Do not concatenate numpy arrays.Arun Isaac
* contrib/cone-vector.py: Import empty. Don't import concatenate. (random_vector_on_spherical_cap): Build random vector without concatenation.
2021-03-10Remove surface area computation.Arun Isaac
Now that we are computing solid angle fractions, there is no need to compute the total surface area of the sphere. * contrib/cone-vector.py (surface_area_of_ball): Delete function. (solid_angle_fraction2planar_angle): Remove surface area computation.
2021-03-10Add Python implementation of cone sampling.Arun Isaac
* contrib/cone-vector.py: New file.