A (work in progress) general purpose spherical/solid harmonics library in Rust.
Documentation: stable, master.
This crate supports these types of real and complex functions via the enums RealSHType
and
ComplexSHType
:
Add this to your Cargo.toml
:
toml
[dependencies]
sphrs = "0.1.0"
Compute the complex spherical harmonic function of degree 2 and order 1 at (spherical) position (r = 1.0, theta = PI/4, phi = PI/4):
```rust use sphrs::{ComplexSHType, Coordinates, SHEval}; use std::f64::consts::PI;
let sh = ComplexSHType::Spherical;
let degree = 2;
let order = 1;
let p: Coordinates
Compute all real SH up to 5th degree at (Cartesian) position (1, 0, 0):
rust
use sphrs::{RealSHType, HarmonicsSet, Coordinates};
let degree = 5;
let sh: HarmonicsSet<f64, _, _> = HarmonicsSet::new(degree, RealSHType::Spherical);
let p = Coordinates::cartesian(1.0, 0.0, 0.0);
println!("SH up to degree {}: {:?}", degree, sh.eval(&p));
This crate is heavily inspired by Google's spherical-harmonics library and follows the design documented here.
Licensed under either of
at your option.
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