# Crate sphrs[−][src]

Expand description

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:

[dependencies]
sphrs = "0.1.3"

# 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 sphrs::{ComplexSHType, Coordinates, SHEval};
use std::f64::consts::PI;

let sh = ComplexSHType::Spherical;
let degree = 2;
let order = 1;
let p: Coordinates<f64> = Coordinates::spherical(1.0, PI/4.0, PI/8.0);
println!("SH ({}, {}): {:?}", degree, order, sh.eval(degree, order, &p));

Compute all real SH up to 5th degree at (Cartesian) position (1, 0, 0):

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));

# Acknowledgements

This crate is heavily inspired by Google’s spherical-harmonics library and follows the design documented here.

# References

## 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.

## Re-exports

pub use crate::coords::*;
pub use crate::sh::*;

## Modules

Coordinates

Spherical/solid harmonics

## Structs

A set of spherical/solid harmonics up to a given degree

## Enums

Available types of complex spherical harmonics and solid harmonics

Available types of real spherical harmonics and solid harmonics

## Traits

SH eval trait (TODO)

Trait alias to simplify common trait bounds