pub struct Axis { /* private fields */ }Implementations§
Source§impl Axis
impl Axis
Sourcepub fn from_values(values: Vec<f64>) -> Result<Self, ErrorsJSL>
pub fn from_values(values: Vec<f64>) -> Result<Self, ErrorsJSL>
An axis on arbitrary increasing samples with trapezoid weights over [first, last].
Sourcepub fn uniform(start: f64, end: f64, n: usize) -> Result<Self, ErrorsJSL>
pub fn uniform(start: f64, end: f64, n: usize) -> Result<Self, ErrorsJSL>
n >= 2 uniform samples from start to end inclusive, trapezoid weights.
Sourcepub fn simpson(start: f64, end: f64, n: usize) -> Result<Self, ErrorsJSL>
pub fn simpson(start: f64, end: f64, n: usize) -> Result<Self, ErrorsJSL>
Uniform samples with composite Simpson weights (n odd, at least 3).
Sourcepub fn periodic(offset: f64, period: f64, n: usize) -> Result<Self, ErrorsJSL>
pub fn periodic(offset: f64, period: f64, n: usize) -> Result<Self, ErrorsJSL>
n uniform samples covering one period [offset, offset + period) (the end point is the
start point again, so it is not repeated).
Sourcepub fn periodic_from_values(
values: Vec<f64>,
period: f64,
) -> Result<Self, ErrorsJSL>
pub fn periodic_from_values( values: Vec<f64>, period: f64, ) -> Result<Self, ErrorsJSL>
Non-uniform samples within one period (trapezoid weights including the wrap-around gap).
Sourcepub fn gauss_legendre(start: f64, end: f64, n: usize) -> Result<Self, ErrorsJSL>
pub fn gauss_legendre(start: f64, end: f64, n: usize) -> Result<Self, ErrorsJSL>
n Gauss-Legendre nodes on [start, end].
Sourcepub fn gauss_legendre_polar(n: usize) -> Result<Self, ErrorsJSL>
pub fn gauss_legendre_polar(n: usize) -> Result<Self, ErrorsJSL>
A polar (θ) axis on (0, π) with Gauss-Legendre nodes in cos θ; see
QuadratureRule::GaussLegendrePolar. Exact on the sphere for polynomials in cos θ
of degree up to 2n - 1, and it never samples the poles.
pub fn values(&self) -> &[f64]
pub fn weights(&self) -> &[f64]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn period(&self) -> Option<f64>
pub fn is_periodic(&self) -> bool
pub fn rule(&self) -> QuadratureRule
pub fn first(&self) -> f64
pub fn last(&self) -> f64
Sourcepub fn is_uniform(&self) -> bool
pub fn is_uniform(&self) -> bool
Whether every gap between samples (including the wrap gap on periodic axes) is equal.
Sourcepub fn wrap_index(&self, i: isize) -> Option<usize>
pub fn wrap_index(&self, i: isize) -> Option<usize>
Maps a possibly out-of-range index to a valid one: wrapping on periodic axes, None
beyond the ends otherwise.
Sourcepub fn reduce(&self, u: f64) -> f64
pub fn reduce(&self, u: f64) -> f64
Reduces a coordinate into the axis’s period (for periodic axes), starting at the first sample.
Sourcepub fn locate(&self, u: f64) -> Option<(usize, f64)>
pub fn locate(&self, u: f64) -> Option<(usize, f64)>
The cell containing u: index i and fraction t in [0, 1] such that
u = values[i] + t (values[i+1] - values[i]) (the “next” sample wraps on periodic axes).
None outside a non-periodic axis’s range (inclusive of the end points), or for a
single-sample non-periodic axis unless u equals the sample.