pub struct ElementQuad {
pub top_left: Point,
pub top_right: Point,
pub bottom_right: Point,
pub bottom_left: Point,
}Fields§
§top_left: Point§top_right: Point§bottom_right: Point§bottom_left: PointImplementations§
Source§impl ElementQuad
impl ElementQuad
pub fn from_quad(quad: &Quad) -> Self
pub fn quad_center(&self) -> Point
Sourcepub fn quad_area(&self) -> f64
pub fn quad_area(&self) -> f64
Compute sum of all directed areas of adjacent triangles https://en.wikipedia.org/wiki/Polygon#Simple_polygons
Sourcepub fn height(&self) -> f64
pub fn height(&self) -> f64
Get the height of the shape based on the vertical distance between the top-left and bottom-left points.
Sourcepub fn width(&self) -> f64
pub fn width(&self) -> f64
Get the width of the shape based on the horizontal distance between the top-left and top-right points.
Sourcepub fn aspect_ratio(&self) -> f64
pub fn aspect_ratio(&self) -> f64
The width divided by the height
Sourcepub fn most_right(&self) -> f64
pub fn most_right(&self) -> f64
The most right (largest) x-coordinate
Sourcepub fn most_bottom(&self) -> f64
pub fn most_bottom(&self) -> f64
The most bottom (largest) y-coordinate
Sourcepub fn strictly_above(&self, other: &Self) -> bool
pub fn strictly_above(&self, other: &Self) -> bool
If the most bottom point of self is above the most top point of
other
Sourcepub fn above(&self, other: &Self) -> bool
pub fn above(&self, other: &Self) -> bool
If the most bottom point of self is above or on the same line as the
most top point of other
Sourcepub fn strictly_below(&self, other: &Self) -> bool
pub fn strictly_below(&self, other: &Self) -> bool
If the most top point of self is below the most bottom point of
other
Sourcepub fn below(&self, other: &Self) -> bool
pub fn below(&self, other: &Self) -> bool
If the most top point of self is below or on the same line as the
most bottom point of other
Sourcepub fn strictly_left_of(&self, other: &Self) -> bool
pub fn strictly_left_of(&self, other: &Self) -> bool
If the most right point of self is left of the most left point of
other
Sourcepub fn left_of(&self, other: &Self) -> bool
pub fn left_of(&self, other: &Self) -> bool
If the most right point of self is left or on the same line as the
most left point of other
Sourcepub fn strictly_right_of(&self, other: &Self) -> bool
pub fn strictly_right_of(&self, other: &Self) -> bool
If the most left point of self is right of the most right point of
other
Sourcepub fn right_of(&self, other: &Self) -> bool
pub fn right_of(&self, other: &Self) -> bool
If the most left point of self is right or on the same line as the
most right point of other
Sourcepub fn within_horizontal_bounds_of(&self, other: &Self) -> bool
pub fn within_horizontal_bounds_of(&self, other: &Self) -> bool
If self is within the left/right boundaries defined by other.
Sourcepub fn within_vertical_bounds_of(&self, other: &Self) -> bool
pub fn within_vertical_bounds_of(&self, other: &Self) -> bool
If self is within the top/bottom boundaries defined by other.
Sourcepub fn within_bounds_of(&self, other: &Self) -> bool
pub fn within_bounds_of(&self, other: &Self) -> bool
If self is within the boundaries defined by other.
Trait Implementations§
Source§impl Clone for ElementQuad
impl Clone for ElementQuad
Source§fn clone(&self) -> ElementQuad
fn clone(&self) -> ElementQuad
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more