Function piston_window::ellipse::centered

source ·
pub fn centered(rect: [f64; 4]) -> [f64; 4]
Expand description

Create a centered rectangle.

rect is interpreted as [x, y, half_width, half_height]

Note that passing an existing types::Rectangle in here will not produce a rectangle of the same dimensions

§Example

use graphics::rectangle::centered;

// We create a rectangle centered on [0.0, 0.0] with width 2.0 and height 6.0
let centered_rect = centered([0.0, 0.0, 1.0, 3.0]);
assert_eq!(centered_rect, [-1.0, -3.0, 2.0, 6.0]);