sphrs
A (work in progress) general purpose spherical/solid harmonics library in Rust.
Documentation: stable, master.
Types of spherical/solid harmonics
This crate supports these types of real and complex functions via the enums RealSHType
and
ComplexSHType
:
Usage
Add this to your Cargo.toml
:
[]
= "0.1.1"
Examples
Compute the complex spherical harmonic function of degree 2 and order 1 at (spherical) position (r = 1.0, theta = PI/4, phi = PI/4):
use ;
use PI;
let sh = Spherical;
let degree = 2;
let order = 1;
let p: = spherical;
println!;
Compute all real SH up to 5th degree at (Cartesian) position (1, 0, 0):
use ;
let degree = 5;
let sh: = new;
let p = cartesian;
println!;
Acknowledgements
This crate is heavily inspired by Google's spherical-harmonics library and follows the design documented here.
References
- Robin Green, "Spherical Harmonic Lighting: The Gritty Details"
- Spherical harmonics (Wikipedia)
- Solid harmonics (Wikipedia)
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
License: MIT OR Apache-2.0