Skip to content

Commit

Permalink
improve creating a VectorPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr Martian committed Feb 20, 2025
1 parent 1371430 commit 62a7ca6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "s2json"
version = "1.5.2"
version = "1.6.0"
edition = "2021"
authors = ["Craig O'Connor <[email protected]>"]
description = "This library supports the S2JSON 1.0 Specification"
Expand Down
8 changes: 4 additions & 4 deletions rust/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@ pub struct VectorPoint {
}
impl VectorPoint {
/// Create a new point
pub fn new(x: f64, y: f64, z: Option<f64>) -> Self {
Self { x, y, z, m: None, t: None }
pub fn new(x: f64, y: f64, z: Option<f64>, m: Option<MValue>) -> Self {
Self { x, y, z, m, t: None }
}

/// Project the point into the 0->1 coordinate system
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 62a7ca6

Please sign in to comment.