pub struct FunctionGraph { /* private fields */ }Expand description
A deterministically sampled function/parametric curve with finite output. Callbacks must be pure; their panics propagate like other user callbacks.
Implementations§
Source§impl FunctionGraph
impl FunctionGraph
Sourcepub fn new(
function: impl Fn(f64) -> f64 + Send + Sync + 'static,
domain: Range<f64>,
) -> Self
pub fn new( function: impl Fn(f64) -> f64 + Send + Sync + 'static, domain: Range<f64>, ) -> Self
Samples y=f(x), including both domain endpoints, with 128 default points.
Sourcepub fn parametric(
function: impl Fn(f64) -> Point + Send + Sync + 'static,
domain: Range<f64>,
) -> Self
pub fn parametric( function: impl Fn(f64) -> Point + Send + Sync + 'static, domain: Range<f64>, ) -> Self
Samples an explicit two-dimensional curve over the given parameter domain.
Sourcepub fn samples(self, samples: usize) -> Self
pub fn samples(self, samples: usize) -> Self
Sets 2..MAX_PATH_VERBS sample points; excessive requests fail before callbacks.
Sourcepub fn try_path(&self) -> Result<Path2D, ValidationError>
pub fn try_path(&self) -> Result<Path2D, ValidationError>
Evaluates a bounded sample list and rejects nonfinite output, never bridges gaps.
Trait Implementations§
Source§impl Clone for FunctionGraph
impl Clone for FunctionGraph
Source§impl Debug for FunctionGraph
impl Debug for FunctionGraph
Source§impl Shape for FunctionGraph
impl Shape for FunctionGraph
Source§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
Geometric bounds; defaults to the path’s cached curve bounds.
Source§fn validate(&self) -> Result<(), ValidationError>
fn validate(&self) -> Result<(), ValidationError>
Reports retained authoring errors before measuring or drawing.
Source§fn as_rect(&self) -> Option<Rect>
fn as_rect(&self) -> Option<Rect>
Exact rectangle equivalent, when available, for a rule-independent fast path.
Auto Trait Implementations§
impl !RefUnwindSafe for FunctionGraph
impl !UnwindSafe for FunctionGraph
impl Forget for FunctionGraph
impl Freeze for FunctionGraph
impl Send for FunctionGraph
impl Sync for FunctionGraph
impl Unpin for FunctionGraph
impl UnsafeUnpin for FunctionGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more