pub struct RotatedIRect {
pub rect: IRect,
pub rotation: f32,
}Expand description
A rectangle that is rotated around the center pivot point.
Fields§
§rect: IRectThe original axis-aligned rectangle.
rotation: f32The rotation to apply to the original rectangle in radians.
Implementations§
Source§impl RotatedIRect
impl RotatedIRect
Sourcepub fn new(rect: IRect, rotation: f32) -> Self
pub fn new(rect: IRect, rotation: f32) -> Self
Create a new rotated rectangle for the given axis-aligned rectangle and rotation value, in radians.
Sourcepub fn rotated_points(&self) -> [Vec2; 4]
pub fn rotated_points(&self) -> [Vec2; 4]
Obtain the four corners of the rotated rectangle.
Sourcepub fn rotated_edges(&self) -> [ILine; 4]
pub fn rotated_edges(&self) -> [ILine; 4]
Obtain the four edge line segments of the rotated rectangle.
Sourcepub fn inner_rect(&self) -> IRect
pub fn inner_rect(&self) -> IRect
Calculate the largest inscribed rectangle within the rotated rectangle.
Sourcepub fn edge_pixels(&self) -> LineStripPixelIterator ⓘ
pub fn edge_pixels(&self) -> LineStripPixelIterator ⓘ
Iterate over the pixel coordinates of the rotated rectangle’s edges.
Sourcepub fn unsigned_edge_pixels(
&self,
) -> UnsignedPixelIterator<LineStripPixelIterator> ⓘ
pub fn unsigned_edge_pixels( &self, ) -> UnsignedPixelIterator<LineStripPixelIterator> ⓘ
Iterate over the positive pixel coordinates of the rotated rectangle’s edges.
Sourcepub fn pixels(&self) -> LineStripPixelIterator ⓘ
pub fn pixels(&self) -> LineStripPixelIterator ⓘ
Iterator over all pixel coordinates, inclusive, within the rotated rectangle.
Sourcepub fn unsigned_pixels(&self) -> UnsignedPixelIterator<LineStripPixelIterator> ⓘ
pub fn unsigned_pixels(&self) -> UnsignedPixelIterator<LineStripPixelIterator> ⓘ
Iterator over all positive pixel coordinates, inclusive, within the rotated rectangle.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RotatedIRect
impl RefUnwindSafe for RotatedIRect
impl Send for RotatedIRect
impl Sync for RotatedIRect
impl Unpin for RotatedIRect
impl UnwindSafe for RotatedIRect
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more