[][src]Struct axgeom::Range

#[must_use]
pub struct Range<T> {
    pub start: T,
    pub end: T,
}

A 1D range. Internally represented as start and end. (as opposed to a start and length) This means that subdivision does not result in any floating point calculations. The start value must be <= the end value. There is no protection against "degenerate" Ranges where start>end. Behavior of any of the functions with degenrate Ranges is unspecified.

A point is consindered inside of a range if the point is in [start,end), a semi-open interval.

Fields

start: Tend: T

Methods

impl<T> Range<T>[src]

pub fn new(start: T, end: T) -> Range<T>[src]

impl<T: Copy + Ord + Sub<Output = T> + Signed> Range<T>[src]

pub fn distance_to_point(&self, pos: T) -> Option<T>[src]

pub fn difference_to_point(&self, pos: T) -> Option<T>[src]

Positive if point is to the right of the range. Negative if point is to the left of range.

impl<T: Copy + PartialOrd> Range<T>[src]

pub fn contains_ext(&self, pos: T) -> Ordering[src]

Like contains() but returns Ord. If the pos is stricly less than the range.start, return less. If the pos is greater of equal to the range.end, return greater. else, return equal.

pub fn contains(&self, pos: T) -> bool[src]

Returns true if the point is inside of the range or on top of.

pub fn subdivide(&self, divider: T) -> (Range<T>, Range<T>)[src]

Subdivides the range. No floating point calculations are done.

#[must_use] pub fn is_valid(&self) -> bool[src]

pub fn grow_to_fit(&mut self, b: &Range<T>)[src]

pub fn contains_range(&self, val: &Range<T>) -> bool[src]

Returns true if self contains the specified range.

pub fn intersects(&self, val: &Range<T>) -> bool[src]

Returns true if two ranges intersect.

impl<T: Copy + Sub<Output = T>> Range<T>[src]

pub fn distance(&self) -> T[src]

impl<T: Copy + Sub<Output = T> + Add<Output = T>> Range<T>[src]

pub fn grow(&mut self, radius: T) -> &mut Self[src]

impl<S: Copy> Range<S>[src]

pub fn inner_as<B: PrimitiveFrom<S>>(&self) -> Range<B>[src]

pub fn inner_into<A: From<S>>(&self) -> Range<A>[src]

pub fn inner_try_into<A: TryFrom<S>>(&self) -> Result<Range<A>, A::Error>[src]

impl<T: Copy + Sub<Output = T> + Add<Output = T>> Range<T>[src]

pub fn from_point(point: T, radius: T) -> Range<T>[src]

Create a range from a point and radius.

impl<T: Copy + Ord> Range<T>[src]

pub fn get_intersection(&self, val: &Range<T>) -> Option<Range<T>>[src]

Creates a range that represents the intersection range.

Trait Implementations

impl<B> AsMut<[B; 2]> for Range<B>[src]

impl<B> AsRef<[B; 2]> for Range<B>[src]

impl<N: Float> AsRef<Range<N>> for Range<NotNan<N>>[src]

impl<T: Clone> Clone for Range<T>[src]

impl<T: Copy> Copy for Range<T>[src]

impl<T: Debug> Debug for Range<T>[src]

impl<T: Eq> Eq for Range<T>[src]

impl<'a, B> From<&'a [B; 2]> for &'a Range<B>[src]

impl<'a, B> From<&'a mut [B; 2]> for &'a mut Range<B>[src]

impl<B> From<[B; 2]> for Range<B>[src]

impl<B> Into<[B; 2]> for Range<B>[src]

impl<T: PartialEq> PartialEq<Range<T>> for Range<T>[src]

impl<T> StructuralEq for Range<T>[src]

impl<T> StructuralPartialEq for Range<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Range<T> where
    T: RefUnwindSafe

impl<T> Send for Range<T> where
    T: Send

impl<T> Sync for Range<T> where
    T: Sync

impl<T> Unpin for Range<T> where
    T: Unpin

impl<T> UnwindSafe for Range<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.