Struct rg3d_core::math::Rect [−][src]
Fields
position: Vector2<T>
size: Vector2<T>
Implementations
impl<T> Rect<T> where
T: Scalar + Add<Output = T> + Sub<Output = T> + Mul<Output = T> + PartialOrd + Copy,
[src]
T: Scalar + Add<Output = T> + Sub<Output = T> + Mul<Output = T> + PartialOrd + Copy,
pub fn new(x: T, y: T, w: T, h: T) -> Self
[src]
#[must_use = "this method creates new instance of rect"]pub fn inflate(&self, dw: T, dh: T) -> Self
[src]
#[must_use = "this method creates new instance of rect"]pub fn deflate(&self, dw: T, dh: T) -> Self
[src]
pub fn contains(&self, pt: Vector2<T>) -> bool
[src]
pub fn push(&mut self, p: Vector2<T>)
[src]
Extends rect to contain given point.
Notes
To build bounding rectangle you should correctly initialize initial rectangle:
let vertices = [Vector2::new(1.0, 2.0), Vector2::new(-3.0, 5.0)]; // This is important part, it must have "invalid" state to correctly // calculate bounding rect. Rect::default will give invalid result! let mut bounding_rect = Rect::new(f32::MAX, f32::MAX, 0.0, 0.0); for &v in &vertices { bounding_rect.push(v); }
#[must_use = "this method creates new instance of rect"]pub fn clip_by(&self, other: Rect<T>) -> Rect<T>
[src]
pub fn intersects(&self, other: Rect<T>) -> bool
[src]
#[must_use = "this method creates new instance of rect"]pub fn translate(&self, translation: Vector2<T>) -> Self
[src]
pub fn left_top_corner(&self) -> Vector2<T>
[src]
pub fn right_top_corner(&self) -> Vector2<T>
[src]
pub fn right_bottom_corner(&self) -> Vector2<T>
[src]
pub fn left_bottom_corner(&self) -> Vector2<T>
[src]
pub fn w(&self) -> T
[src]
pub fn h(&self) -> T
[src]
pub fn x(&self) -> T
[src]
pub fn y(&self) -> T
[src]
Trait Implementations
impl<T: Clone + Scalar> Clone for Rect<T>
[src]
impl<T: Copy + Scalar> Copy for Rect<T>
[src]
impl<T: Debug + Scalar> Debug for Rect<T>
[src]
impl<T: Scalar + Default> Default for Rect<T>
[src]
impl<T: PartialEq + Scalar> PartialEq<Rect<T>> for Rect<T>
[src]
impl<T: Scalar> StructuralPartialEq for Rect<T>
[src]
impl<T> Visit for Rect<T> where
T: Scalar + Visit + 'static,
[src]
T: Scalar + Visit + 'static,
fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult
[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> Same<T> for T
type Output = T
Should always be Self
impl<T> Scalar for T where
T: Copy + PartialEq<T> + Debug + Any,
[src]
T: Copy + PartialEq<T> + Debug + Any,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,