mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 16:36:02 +03:00
Bounds::zero and Bounds::eq
This commit is contained in:
parent
4c6d7af76d
commit
f8a9844b2c
@ -5,7 +5,7 @@ use aabb_quadtree::geom::{Point, Rect};
|
|||||||
use crate::{LonLat, Polygon, Pt2D, Ring};
|
use crate::{LonLat, Polygon, Pt2D, Ring};
|
||||||
|
|
||||||
/// Represents a rectangular boundary of `Pt2D` points.
|
/// Represents a rectangular boundary of `Pt2D` points.
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Bounds {
|
pub struct Bounds {
|
||||||
pub min_x: f64,
|
pub min_x: f64,
|
||||||
pub min_y: f64,
|
pub min_y: f64,
|
||||||
@ -24,6 +24,15 @@ impl Bounds {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn zero() -> Self {
|
||||||
|
Bounds {
|
||||||
|
min_x: 0.0,
|
||||||
|
min_y: 0.0,
|
||||||
|
max_x: 0.0,
|
||||||
|
max_y: 0.0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Create a boundary covering some points.
|
/// Create a boundary covering some points.
|
||||||
pub fn from(pts: &Vec<Pt2D>) -> Bounds {
|
pub fn from(pts: &Vec<Pt2D>) -> Bounds {
|
||||||
let mut b = Bounds::new();
|
let mut b = Bounds::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user