[−][src]Struct axgeom::Rect
An axis aligned rectangle. Stored as two Ranges. It is a semi-closed rectangle. A point is considered inside the rectangle if it is in [start,end) for both x and y.
Fields
x: Range<T>
y: Range<T>
Implementations
impl<S: Copy> Rect<S>
[src]
#[must_use]pub fn inner_into<A: From<S>>(&self) -> Rect<A>
[src]
#[must_use]pub fn inner_try_into<A: TryFrom<S>>(&self) -> Result<Rect<A>, A::Error>
[src]
impl<T: Copy + Sub<Output = T> + Add<Output = T>> Rect<T>
[src]
#[must_use]pub fn from_point(point: Vec2<T>, radius: Vec2<T>) -> Rect<T>
[src]
Create a rectangle from a point and radius.
impl<T> Rect<T>
[src]
#[must_use]pub fn get_range(&self, axis: impl Axis) -> &Range<T>
[src]
Get the range of one axis.
#[must_use]pub fn get_range_mut(&mut self, axis: impl Axis) -> &mut Range<T>
[src]
Get the mutable range of one axis.
impl<T> Rect<T>
[src]
#[must_use]pub fn new(a: T, b: T, c: T, d: T) -> Rect<T>
[src]
(a,b) is the x component range. (c,d) is the y component range.
impl<T: Copy> Rect<T>
[src]
pub fn top_left(&self) -> Vec2<T>
[src]
pub fn get_corners(&self) -> [Vec2<T>; 4]
[src]
Returns each corner in this order: topleft topright bottomright bottomleft
pub fn inner_as<B: PrimitiveFrom<T>>(&self) -> Rect<B>
[src]
pub fn get(&self) -> ((T, T), (T, T))
[src]
(a,b) is the x component range. (c,d) is the y component range.
impl<T: PartialOrd + Copy> Rect<T>
[src]
pub fn contains_point(&self, a: Vec2<T>) -> bool
[src]
Returns true if the point is contained in the the ranges of both axis.
impl<T: Copy + Sub<Output = T> + Add<Output = T>> Rect<T>
[src]
impl<T: Copy + PartialOrd + Sub<Output = T> + Mul<Output = T> + Add<Output = T>> Rect<T>
[src]
pub fn distance_squared_to_point(&self, point: Vec2<T>) -> Option<T>
[src]
If the point is outisde the rectangle, returns the squared distance from a point to a rectangle. If the point is inside the rectangle, it will return None.
impl<T: Num + Copy> Rect<T>
[src]
pub fn derive_center(&self) -> Vec2<T>
[src]
impl<T: PartialOrd + Copy> Rect<T>
[src]
pub fn subdivide<A: Axis>(&self, axis: A, divider: T) -> (Rect<T>, Rect<T>)
[src]
Subdivides the rectangle. No floating point calculations are done. Important to note that a point that was in the original rectangle, could actually be inside both subdivded rectangles. This is because the ranges are inclusive on both sides [start,end].
pub fn is_valid(&self) -> bool
[src]
Returns true if the rectangle's ranges are not degenerate.
pub fn contains_rect(&self, rect: &Rect<T>) -> bool
[src]
Returns true if the specified rect is inside of this rect.
pub fn grow_to_fit_point(&mut self, point: Vec2<T>) -> &mut Self
[src]
pub fn grow_to_fit(&mut self, rect: &Rect<T>) -> &mut Self
[src]
Grow the rectangle to fit the specified rectangle by replacing values with the specified rectangle. No floating point computations.
pub fn intersects_rect(&self, other: &Rect<T>) -> bool
[src]
impl<T: Ord + Copy> Rect<T>
[src]
pub fn get_intersect_rect(&self, other: &Rect<T>) -> Option<Rect<T>>
[src]
Get an intersecting rectangle. No floating point calculations as the new rectangle is made up of values from this rectangle and the specified rectangle.
Trait Implementations
impl<B> AsMut<[B; 4]> for Rect<B>
[src]
impl<B> AsRef<[B; 4]> for Rect<B>
[src]
impl<N: Float> AsRef<Rect<N>> for Rect<NotNan<N>>
[src]
impl<T: Clone> Clone for Rect<T>
[src]
impl<T: Copy> Copy for Rect<T>
[src]
impl<T: Debug> Debug for Rect<T>
[src]
impl<T: Eq> Eq for Rect<T>
[src]
impl<'a, B> From<&'a [B; 4]> for &'a Rect<B>
[src]
impl<'a, B> From<&'a mut [B; 4]> for &'a mut Rect<B>
[src]
impl<B> From<[B; 4]> for Rect<B>
[src]
impl<B> Into<[B; 4]> for Rect<B>
[src]
impl<T: PartialEq> PartialEq<Rect<T>> for Rect<T>
[src]
impl<T> StructuralEq for Rect<T>
[src]
impl<T> StructuralPartialEq for Rect<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Rect<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Rect<T> where
T: Send,
T: Send,
impl<T> Sync for Rect<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Rect<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Rect<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,