pub struct Rect {
pub min: Vec2,
pub max: Vec2,
}Expand description
轴对齐矩形,min 为左上角。
Fields§
§min: Vec2§max: Vec2Implementations§
Source§impl Rect
impl Rect
pub fn from_origin_size(origin: Vec2, size: Size2) -> Self
Sourcepub fn from_corners(a: Vec2, b: Vec2) -> Self
pub fn from_corners(a: Vec2, b: Vec2) -> Self
由任意两个角构造(框选时起点可能在右下)。
pub fn from_points(points: &[Vec2]) -> Option<Self>
pub fn width(&self) -> f32
pub fn height(&self) -> f32
pub fn center(&self) -> Vec2
pub fn contains(&self, p: Vec2) -> bool
pub fn contains_rect(&self, o: &Rect) -> bool
pub fn intersects(&self, o: &Rect) -> bool
pub fn union(&self, o: Rect) -> Rect
pub fn inflate(&self, d: f32) -> Rect
Trait Implementations§
impl Copy for Rect
Source§impl<'de> Deserialize<'de> for Rect
impl<'de> Deserialize<'de> for Rect
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Forget for Rect
impl Freeze for Rect
impl Move for Rect
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnsafeUnpin for Rect
impl UnwindSafe for Rect
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