Skip to main content

ScalInF64

Struct ScalInF64 

Source
pub struct ScalInF64 {
    pub lo: f64,
    pub hi: f64,
}
Expand description

Interval f64 scalar: [lo, hi] with outward-rounded arithmetic.

Fields§

§lo: f64§hi: f64

Implementations§

Source§

impl ScalInF64

Source

pub fn new(lo: f64, hi: f64) -> Self

Create a proper interval. Panics in debug if lo > hi.

Source

pub fn degenerate(v: f64) -> Self

Degenerate (point) interval.

Trait Implementations§

Source§

impl Add for ScalInF64

Source§

type Output = ScalInF64

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl Clone for ScalInF64

Source§

fn clone(&self) -> ScalInF64

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ScalInF64

Source§

impl Debug for ScalInF64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ScalInF64

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for ScalInF64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Field for ScalInF64

Source§

fn div(self, other: Self) -> GeopResult<Self>

Source§

impl From<f64> for ScalInF64

Source§

fn from(v: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for ScalInF64

Source§

fn from(v: i64) -> Self

Converts to this type from the input type.
Source§

impl Mul for ScalInF64

Source§

type Output = ScalInF64

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
Source§

impl Neg for ScalInF64

Source§

type Output = ScalInF64

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl PartialEq for ScalInF64

Source§

fn eq(&self, other: &ScalInF64) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Ring for ScalInF64

Source§

fn add(self, other: Self) -> Self

Source§

fn sub(self, other: Self) -> Self

Source§

fn mul(self, other: Self) -> Self

Source§

fn neg(self) -> Self

Source§

impl Scalar for ScalInF64

Source§

const ZERO: Self

Source§

const ONE: Self

Source§

const TWO: Self

Source§

const PI: Self

Source§

const E: Self

Source§

const INFINITY: Self

Saturation sentinel — set on overflow.
Source§

const ENTIRE: Self

The “entire” interval (-inf, inf) — the top element of the interval lattice. could_be_equal/could_be_greater/could_be_less against it are always true, and it never satisfies definitely_*. Used to represent a value or a whole curve/surface whose position is not yet known — an unsharp placeholder that automatically passes any overlap/equality check made against it.
Source§

fn from_i64(v: i64) -> Self

Source§

fn from_f64(v: f64) -> Self

Source§

fn from_ratio(num: i64, den: i64) -> GeopResult<Self>

Source§

fn abs(self) -> Self

Source§

fn sqrt(self) -> GeopResult<Self>

Source§

fn sin(self) -> Self

Outward-rounded enclosure of sin/cos over the whole interval (radians). Total — never fails, even for Scalar::ENTIRE or an Scalar::INFINITY-adjacent value, which just widen to [-1, 1].
Source§

fn cos(self) -> Self

Source§

fn could_be_equal(self, other: Self) -> bool

Source§

fn definitely_not_equal(self, other: Self) -> bool

Source§

fn could_be_greater(self, other: Self) -> bool

Source§

fn definitely_greater(self, other: Self) -> bool

Source§

fn could_be_less(self, other: Self) -> bool

Source§

fn definitely_less(self, other: Self) -> bool

Source§

fn is_infinite(self) -> bool

Source§

fn is_finite(self) -> bool

Source§

fn midpoint(self) -> Self

Source§

fn is_sharp(self) -> bool

True iff this value carries no width — it’s a single, exactly-known point, not a genuine range of possibility.
Source§

fn lower(self) -> Self

The sharp lower / upper endpoint of this enclosure. Every value self could be is >= lower() and <= upper(), so these are the outer bounds to cut at when a search restricts a domain to an enclosure of its answer: a cut there never loses a solution (unlike Scalar::sharpen, which would cut through the enclosure).
Source§

fn upper(self) -> Self

Source§

fn width(self) -> Self

How much possibility this enclosure carries: hi - lo, as a sharp, non-negative value. Zero exactly when Scalar::is_sharp. Read more
Source§

fn intersect(self, other: Self) -> Self

The largest value contained in both self and other — the dual of Scalar::union. Callers must only intersect two enclosures of the same underlying exact value (as Scalar::interpolate does); given that, the result is still an honest enclosure, just a tighter one. Implementations may return either input if the two somehow don’t overlap, rather than fabricating an empty/inverted interval.
Source§

fn to_f64(self) -> f64

Approximate f64 midpoint. For point scalars returns the value; for interval scalars returns (lo + hi) / 2. Used only for rendering/debugging.
Source§

fn union(self, other: Self) -> Self

The smallest value definitely containing both self and other — the scalar-level analog of Set::union.
Source§

fn is_subset_of(self, other: Self) -> bool

True iff self is contained in other as sets: other.lo <= self.lo and self.hi <= other.hi. This is the rigorous existence/uniqueness test a Krawczyk-style contraction relies on (K(X) ⊆ X) — distinct from Scalar::could_be_equal, which only asks whether the two enclosures overlap. self.intersect(other).could_be_equal(self) would answer the same question but at the cost of rebuilding an enclosure just to throw it away; implementations should compare bounds directly.
Source§

fn sharpen(self) -> Self

Collapse to a single representative point (currently the midpoint, like Scalar::midpoint, but named for its distinct purpose: use this only when you are free to pick any value within self and don’t need to preserve which one — e.g. choosing where to place a new knot when subdividing a curve at an arbitrary interior point. Never use this to compress a value that represents a genuinely uncertain physical quantity (a search’s converged bound, a measured position) — that would silently discard real uncertainty rather than making an arbitrary, harmless choice. Read more
Source§

fn interpolate(a: Self, b: Self, alpha: Self) -> Self

Point a fraction alpha of the way from a to b: a at alpha=0, b at alpha=1. Read more
Source§

impl StructuralPartialEq for ScalInF64

Source§

impl Sub for ScalInF64

Source§

type Output = ScalInF64

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<S> Mergeable for S
where S: Scalar,

Source§

fn could_be_equal(&self, other: &S) -> bool

Source§

fn union(&self, other: &S) -> S

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.