pub struct RealInterval {
pub min: f32,
pub max: f32,
}Expand description
Represents a closed range on the real numbers.
Fields§
§min: f32The starting value of this range.
max: f32The ending value of this range.
Implementations§
Source§impl RealInterval
impl RealInterval
Sourcepub fn min_max(min: f32, max: f32) -> Self
pub fn min_max(min: f32, max: f32) -> Self
Creates a new interval from the given minimum and maximum. The maximum must be at least as big as the minimum, or this will panic.
Sourcepub fn point_extents(value: f32, half_extent: f32) -> Self
pub fn point_extents(value: f32, half_extent: f32) -> Self
Creates a range from a point and extents around the point.
Sourcepub fn contains(self, value: f32) -> bool
pub fn contains(self, value: f32) -> bool
Determines whether the provided value lies within this interval.
Sourcepub fn powf(self, value: f32) -> Self
pub fn powf(self, value: f32) -> Self
Applies a scalar power to this range. The interval must be non-negative.
Sourcepub fn mul_pow2(self, value: i32) -> Option<Self>
pub fn mul_pow2(self, value: i32) -> Option<Self>
Multiplies this range by the provided integer power of 2.
Sourcepub fn mul_pow2_unchecked(self, value: i32) -> Self
pub fn mul_pow2_unchecked(self, value: i32) -> Self
Multiplies this range by the provided integer power of 2 without overflow checking. This function is safe, but in the case where the exponent of either minimum or maximum has an overflow, the result is not specified.
Trait Implementations§
Source§impl Add<f32> for RealInterval
impl Add<f32> for RealInterval
Source§impl Add for RealInterval
impl Add for RealInterval
Source§impl BitAnd for RealInterval
impl BitAnd for RealInterval
Source§impl BitOr for RealInterval
impl BitOr for RealInterval
Source§impl Clone for RealInterval
impl Clone for RealInterval
Source§fn clone(&self) -> RealInterval
fn clone(&self) -> RealInterval
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RealInterval
impl Debug for RealInterval
Source§impl Default for RealInterval
impl Default for RealInterval
Source§fn default() -> RealInterval
fn default() -> RealInterval
Returns the “default value” for a type. Read more
Source§impl Display for RealInterval
impl Display for RealInterval
Source§impl Mul<RealInterval> for f32
impl Mul<RealInterval> for f32
Source§type Output = RealInterval
type Output = RealInterval
The resulting type after applying the
* operator.Source§impl Mul<f32> for RealInterval
impl Mul<f32> for RealInterval
Source§impl Mul for RealInterval
impl Mul for RealInterval
Source§type Output = RealInterval
type Output = RealInterval
The resulting type after applying the
* operator.Source§impl Neg for RealInterval
impl Neg for RealInterval
Source§impl PartialEq for RealInterval
impl PartialEq for RealInterval
Source§impl Sub<f32> for RealInterval
impl Sub<f32> for RealInterval
Source§impl Sub for RealInterval
impl Sub for RealInterval
impl Copy for RealInterval
impl StructuralPartialEq for RealInterval
Auto Trait Implementations§
impl Freeze for RealInterval
impl RefUnwindSafe for RealInterval
impl Send for RealInterval
impl Sync for RealInterval
impl Unpin for RealInterval
impl UnwindSafe for RealInterval
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