From 62a7ca6c84b2d8ea02fbb159240f8b8a56fce2c8 Mon Sep 17 00:00:00 2001 From: Mr Martian Date: Thu, 20 Feb 2025 13:51:47 -0500 Subject: [PATCH] improve creating a VectorPoint --- Cargo.lock | 2 +- Cargo.toml | 2 +- rust/geometry.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index faadd2c..4157f66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,7 +40,7 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "s2json" -version = "1.5.2" +version = "1.6.0" dependencies = [ "libm", "serde", diff --git a/Cargo.toml b/Cargo.toml index 6263dbf..99559fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "s2json" -version = "1.5.2" +version = "1.6.0" edition = "2021" authors = ["Craig O'Connor "] description = "This library supports the S2JSON 1.0 Specification" diff --git a/rust/geometry.rs b/rust/geometry.rs index a52c850..5172ecf 100644 --- a/rust/geometry.rs +++ b/rust/geometry.rs @@ -645,8 +645,8 @@ pub struct VectorPoint { } impl VectorPoint { /// Create a new point - pub fn new(x: f64, y: f64, z: Option) -> Self { - Self { x, y, z, m: None, t: None } + pub fn new(x: f64, y: f64, z: Option, m: Option) -> Self { + Self { x, y, z, m, t: None } } /// Project the point into the 0->1 coordinate system @@ -819,8 +819,8 @@ mod tests { #[test] fn test_bbox_functions() { let bbox = BBox::new(0., 0., 1., 1.); - assert!(bbox.point_overlap(VectorPoint::new(0.5, 0.5, None))); - assert!(!bbox.point_overlap(VectorPoint::new(2.0, 2.0, None))); + assert!(bbox.point_overlap(VectorPoint::new(0.5, 0.5, None, None))); + assert!(!bbox.point_overlap(VectorPoint::new(2.0, 2.0, None, None))); let bbox2 = BBox { left: 0.5, bottom: 0.5, right: 1.5, top: 1.5 }; assert_eq!( bbox.overlap(&bbox2),