Struct rect_iter::RectRange[][src]

pub struct RectRange<T: Num + PartialOrd> { /* fields omitted */ }

RectRange is rectangle representation using std::ops::Range.

Diffrent from Range, RectRange itself isn't a iterator, but has IntoIterator implementation and iter method(with 'clone').

Methods

impl<T: Num + PartialOrd> RectRange<T>
[src]

construct a range from left x, lower y, right x, upper y

construct a range x_range: 0..x, y_range: 0..y

construct a range x_range: 0..p.x, y_range: 0..p.y

construct a range x_range: 0..x, y_range: 0..y

checks if the range contains the point

get a reference of x range

get a reference of y range

get a mutable reference of x range

get a mutable reference of y range

checks if the range is valid or not

impl<T: Num + PartialOrd + Clone> RectRange<T>
[src]

get x range

get y range

slide range by the given point

slide start point without checking

slide end point without checking

the length in the x-axis deirection

the length of in the y-axis deirection

calc the area of the range

judges if 2 ranges have intersection

gets the intersection of 2 ranges

get the upper left corner(inclusive)

get the upper right corner(inclusive)

get the lower left corner(inclusive)

get the lower right corner(inclusive)

checks if the point is on the edge of the rectangle

checks if the point is on the vertical edge of the rectangle

checks if the point is on the horizoni edge of the rectangle

impl<T: Num + PartialOrd + Copy> RectRange<T>
[src]

generate RectRange from corners(lower: inclusive, upper: exclusive)

Important traits for RectIter<T>

get iterator from reference

expand the rectangle

impl<T: Num + PartialOrd + ToPrimitive + Copy> RectRange<T>
[src]

impl<T: Num + PartialOrd + Copy + FromPrimitive + ToPrimitive> RectRange<T>
[src]

returns self.xlen * self.ylen as usize

return 'nth' element same as RectIter::nth, but much faster(O(1))

take Point and return 0-start unique index using the same order as RectIter

Trait Implementations

impl<T: Clone + Num + PartialOrd> Clone for RectRange<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Debug + Num + PartialOrd> Debug for RectRange<T>
[src]

Formats the value using the given formatter. Read more

impl<T: PartialEq + Num + PartialOrd> PartialEq for RectRange<T>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T: Eq + Num + PartialOrd> Eq for RectRange<T>
[src]

impl<T: Hash + Num + PartialOrd> Hash for RectRange<T>
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<T: Num + PartialOrd + Copy> IntoIterator for RectRange<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

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

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