diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/svgbob/Cargo.toml | 4 | ||||
-rw-r--r-- | packages/svgbob/src/buffer/cell_buffer/cell.rs | 8 | ||||
-rw-r--r-- | packages/svgbob/src/buffer/fragment_buffer/fragment.rs | 10 | ||||
-rw-r--r-- | packages/svgbob/src/buffer/fragment_buffer/fragment/line.rs | 2 | ||||
-rw-r--r-- | packages/svgbob/src/util.rs | 10 |
5 files changed, 17 insertions, 17 deletions
diff --git a/packages/svgbob/Cargo.toml b/packages/svgbob/Cargo.toml index 42be7fd..3f82922 100644 --- a/packages/svgbob/Cargo.toml +++ b/packages/svgbob/Cargo.toml @@ -10,8 +10,8 @@ license = "Apache-2.0" edition = "2021" [dependencies] -nalgebra = "0.30.1" -parry2d = "0.8.0" +nalgebra = "0.32.1" +parry2d = "0.13.5" lazy_static = "1.3.0" sauron = { version = "0.57.0", default-features = false} #sauron = { path = "../../../sauron", default-features = false} diff --git a/packages/svgbob/src/buffer/cell_buffer/cell.rs b/packages/svgbob/src/buffer/cell_buffer/cell.rs index faf07b9..237edf8 100644 --- a/packages/svgbob/src/buffer/cell_buffer/cell.rs +++ b/packages/svgbob/src/buffer/cell_buffer/cell.rs @@ -1,6 +1,6 @@ use crate::{util, Point}; use parry2d::{ - bounding_volume::AABB, + bounding_volume::Aabb, math::Isometry, query::{intersection_test, PointQuery}, shape::{Polyline, Segment}, @@ -129,7 +129,7 @@ impl Cell { /// the bounding box of this cell #[inline] - fn bounding_box(&self) -> AABB { + fn bounding_box(&self) -> Aabb { let start = Point::new( self.x as f32 * Self::width(), self.y as f32 * Self::height(), @@ -138,7 +138,7 @@ impl Cell { (self.x + 1) as f32 * Self::width(), (self.y + 1) as f32 * Self::height(), ); - AABB::new(*start, *end) + Aabb::new(*start, *end) } /// Convert the bounding box aabb to polyline segment @@ -433,7 +433,7 @@ mod tests { #[test] fn test_aabb() { assert_eq!( - AABB::new(*Point::new(0.0, 0.0), *Point::new(1.0, 2.0)), + Aabb::new(*Point::new(0.0, 0.0), *Point::new(1.0, 2.0)), Cell::new(0, 0).bounding_box() ); } diff --git a/packages/svgbob/src/buffer/fragment_buffer/fragment.rs b/packages/svgbob/src/buffer/fragment_buffer/fragment.rs index aa041ab..1cef8f1 100644 --- a/packages/svgbob/src/buffer/fragment_buffer/fragment.rs +++ b/packages/svgbob/src/buffer/fragment_buffer/fragment.rs @@ -5,7 +5,7 @@ pub use circle::Circle; pub use line::Line; pub use marker_line::{Marker, MarkerLine}; use parry2d::{ - bounding_volume::{BoundingVolume, AABB}, + bounding_volume::{Aabb, BoundingVolume}, math::Isometry, query::{intersection_test, PointQuery}, shape::{ConvexPolygon, Polyline, Segment, Shape}, @@ -167,13 +167,13 @@ impl Fragment { } pub fn hit(&self, start: Point, end: Point) -> bool { - self.is_intersecting(&AABB::new(*start, *end)) + self.is_intersecting(&Aabb::new(*start, *end)) } /// check if this fragment is intersecting with this bounding box /// Note: if intersection logic requires testing the solid shape inside the polygon /// use the ConvexPolygon of each shape instead of Polyline - pub fn is_intersecting(&self, bbox: &AABB) -> bool { + pub fn is_intersecting(&self, bbox: &Aabb) -> bool { let points = vec![ *Point::new(bbox.mins.x, bbox.mins.y), *Point::new(bbox.maxs.x, bbox.mins.y), @@ -206,9 +206,9 @@ impl Fragment { } /// check if this fragment can be contain in the specified bounding box `bbox` - pub fn is_inside(&self, bbox: &AABB) -> bool { + pub fn is_inside(&self, bbox: &Aabb) -> bool { let (start, end) = self.bounds(); - let frag_bound = AABB::new(*start, *end); + let frag_bound = Aabb::new(*start, *end); bbox.contains(&frag_bound) } diff --git a/packages/svgbob/src/buffer/fragment_buffer/fragment/line.rs b/packages/svgbob/src/buffer/fragment_buffer/fragment/line.rs index 48e6fc2..aa1aa87 100644 --- a/packages/svgbob/src/buffer/fragment_buffer/fragment/line.rs +++ b/packages/svgbob/src/buffer/fragment_buffer/fragment/line.rs @@ -4,7 +4,7 @@ use crate::{ util, Direction, Point, }; use parry2d::{ - bounding_volume::AABB, + bounding_volume::Aabb, math::Isometry, query::PointQuery, shape::{Polyline, Segment, Shape}, diff --git a/packages/svgbob/src/util.rs b/packages/svgbob/src/util.rs index 21aa7f7..d6e97d5 100644 --- a/packages/svgbob/src/util.rs +++ b/packages/svgbob/src/util.rs @@ -1,6 +1,6 @@ use crate::Point; use parry2d::{ - bounding_volume::AABB, math::Isometry, query::PointQuery, shape::Triangle, + bounding_volume::Aabb, math::Isometry, query::PointQuery, shape::Triangle, }; use std::cmp::Ordering; @@ -31,7 +31,7 @@ pub fn ord(f1: f32, f2: f32) -> Ordering { /// clips a line to the bounding box of this whole grid /// and approximate each point to the closes intersection fn clip_line_internal( - aabb: &AABB, + aabb: &Aabb, start: Point, end: Point, ) -> Option<(Point, Point)> { @@ -49,7 +49,7 @@ fn clip_line_internal( /// clip a line but do not extend the points pub fn clip_line( - aabb: &AABB, + aabb: &Aabb, start: Point, end: Point, ) -> Option<(Point, Point)> { @@ -476,7 +476,7 @@ mod tests { fn test_clip_line() { let a = CellGrid::a(); let b = CellGrid::b(); - let bounds = AABB::new(*a, *b); + let bounds = Aabb::new(*a, *b); let clip = clip_line(&bounds, a, b); println!("clip: {:#?}", clip); assert_eq!(clip, Some((a, b))); @@ -487,7 +487,7 @@ mod tests { let c = CellGrid::c(); let m = CellGrid::m(); let w = CellGrid::w(); - let bounds = AABB::new(*m, *w); + let bounds = Aabb::new(*m, *w); let clip = clip_line(&bounds, c, w); println!("clip: {:#?}", clip); assert_eq!(clip, Some((m, w))); |