Module geometry::corner

source ·
Expand description

Describes the corners of axis-aligned rectangles.

§Examples

You can access the corners of a Rect:

let rect = Rect::from_sides(10, 20, 30, 40);
assert_eq!(rect.corner(Corner::LowerRight), Point::new(30, 20));

You can also increase the size of a Rect by pushing out one of its corners:

let rect = Rect::from_sides(10, 20, 30, 40);
assert_eq!(rect.expand_corner(Corner::UpperLeft, 100), Rect::from_sides(-90, 20, 30, 140));

Structs§

Enums§

  • An enumeration of the corners of an axis-aligned rectangle.