summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJovansonlee Cesar <ivanceras@gmail.com>2021-07-12 17:03:10 +0800
committerJovansonlee Cesar <ivanceras@gmail.com>2021-07-12 17:03:10 +0800
commite7317b90e70eea6601cfb03b98d891755a27e5a1 (patch)
treeefaa1937e864a6dcdad2955ca97f32c227a3fe37
parentf662289512e4e3f4e5dc3ec843b54c4039aa22e3 (diff)
Update to the lastest version of nalgebra and ncollide2d
-rw-r--r--svgbob/Cargo.toml4
-rw-r--r--svgbob/src/buffer/cell_buffer/cell.rs4
-rw-r--r--svgbob/src/buffer/fragment_buffer/fragment.rs8
-rw-r--r--svgbob/src/buffer/fragment_buffer/fragment/arc.rs2
-rw-r--r--svgbob/src/buffer/fragment_buffer/fragment/line.rs2
-rw-r--r--svgbob/src/buffer/fragment_buffer/fragment/polygon.rs2
-rw-r--r--svgbob/src/buffer/fragment_buffer/fragment/rect.rs2
-rw-r--r--svgbob/src/point.rs13
-rw-r--r--svgbob/src/util.rs9
9 files changed, 28 insertions, 18 deletions
diff --git a/svgbob/Cargo.toml b/svgbob/Cargo.toml
index dfdd130..917b9d4 100644
--- a/svgbob/Cargo.toml
+++ b/svgbob/Cargo.toml
@@ -10,8 +10,8 @@ keywords = ["ascii","plain","text", "svg", "bob"]
license = "Apache-2.0"
[dependencies]
-nalgebra = "0.18.0"
-ncollide2d = "0.19.1"
+nalgebra = "0.28"
+ncollide2d = "0.31"
lazy_static = "1.3.0"
sauron = { version = "0.34" }
unicode-width = "0.1.5"
diff --git a/svgbob/src/buffer/cell_buffer/cell.rs b/svgbob/src/buffer/cell_buffer/cell.rs
index cf49dcb..098e6d5 100644
--- a/svgbob/src/buffer/cell_buffer/cell.rs
+++ b/svgbob/src/buffer/cell_buffer/cell.rs
@@ -142,8 +142,8 @@ impl Cell {
/// The polyline is then used to testing for intersection with the line segment
fn polyline(&self) -> Polyline<f32> {
let aabb = self.bounding_box();
- let min = aabb.mins();
- let max = aabb.maxs();
+ let min = aabb.mins;
+ let max = aabb.maxs;
let x1 = min.x;
let y1 = min.y;
let x2 = max.x;
diff --git a/svgbob/src/buffer/fragment_buffer/fragment.rs b/svgbob/src/buffer/fragment_buffer/fragment.rs
index 40eeaf5..95e31e5 100644
--- a/svgbob/src/buffer/fragment_buffer/fragment.rs
+++ b/svgbob/src/buffer/fragment_buffer/fragment.rs
@@ -301,10 +301,10 @@ impl Fragment {
pub fn is_intersecting(&self, bbox: &AABB<f32>) -> bool {
let bbox: Polyline<f32> = Polyline::new(
vec![
- *bbox.mins(),
- *Point::new(bbox.maxs().x, bbox.mins().y),
- *bbox.maxs(),
- *Point::new(bbox.mins().x, bbox.maxs().y),
+ *Point::new(bbox.mins.x, bbox.mins.y),
+ *Point::new(bbox.maxs.x, bbox.mins.y),
+ *Point::new(bbox.maxs.x, bbox.maxs.y),
+ *Point::new(bbox.mins.x, bbox.maxs.y),
],
None,
);
diff --git a/svgbob/src/buffer/fragment_buffer/fragment/arc.rs b/svgbob/src/buffer/fragment_buffer/fragment/arc.rs
index 756a8d4..5d7963e 100644
--- a/svgbob/src/buffer/fragment_buffer/fragment/arc.rs
+++ b/svgbob/src/buffer/fragment_buffer/fragment/arc.rs
@@ -139,7 +139,7 @@ impl Arc {
impl Bounds for Arc {
fn bounds(&self) -> (Point, Point) {
let aabb = Segment::new(*self.start, *self.end).local_aabb();
- (Point::from(*aabb.mins()), Point::from(*aabb.maxs()))
+ (Point::from(*aabb.mins), Point::from(*aabb.maxs))
}
}
diff --git a/svgbob/src/buffer/fragment_buffer/fragment/line.rs b/svgbob/src/buffer/fragment_buffer/fragment/line.rs
index 7e8be28..2360bb7 100644
--- a/svgbob/src/buffer/fragment_buffer/fragment/line.rs
+++ b/svgbob/src/buffer/fragment_buffer/fragment/line.rs
@@ -507,7 +507,7 @@ impl Line {
impl Bounds for Line {
fn bounds(&self) -> (Point, Point) {
let aabb = Segment::new(*self.start, *self.end).local_aabb();
- (Point::from(*aabb.mins()), Point::from(*aabb.maxs()))
+ (Point::from(*aabb.mins), Point::from(*aabb.maxs))
}
}
diff --git a/svgbob/src/buffer/fragment_buffer/fragment/polygon.rs b/svgbob/src/buffer/fragment_buffer/fragment/polygon.rs
index 46d751f..f61e53c 100644
--- a/svgbob/src/buffer/fragment_buffer/fragment/polygon.rs
+++ b/svgbob/src/buffer/fragment_buffer/fragment/polygon.rs
@@ -177,7 +177,7 @@ impl Bounds for Polygon {
fn bounds(&self) -> (Point, Point) {
let pl: Polyline<f32> = self.clone().into();
let aabb = pl.local_aabb();
- (Point::from(*aabb.mins()), Point::from(*aabb.maxs()))
+ (Point::from(*aabb.mins), Point::from(*aabb.maxs))
}
}
diff --git a/svgbob/src/buffer/fragment_buffer/fragment/rect.rs b/svgbob/src/buffer/fragment_buffer/fragment/rect.rs
index a74cc6c..27264a8 100644
--- a/svgbob/src/buffer/fragment_buffer/fragment/rect.rs
+++ b/svgbob/src/buffer/fragment_buffer/fragment/rect.rs
@@ -110,7 +110,7 @@ impl Rect {
impl Bounds for Rect {
fn bounds(&self) -> (Point, Point) {
let aabb = Segment::new(*self.start, *self.end).local_aabb();
- (Point::from(*aabb.mins()), Point::from(*aabb.maxs()))
+ (Point::from(*aabb.mins), Point::from(*aabb.maxs))
}
}
diff --git a/svgbob/src/point.rs b/svgbob/src/point.rs
index 18a8015..7779650 100644
--- a/svgbob/src/point.rs
+++ b/svgbob/src/point.rs
@@ -1,6 +1,7 @@
use crate::buffer::CellGrid;
use crate::util;
use crate::Cell;
+use nalgebra::coordinates::XY;
use nalgebra::{Point2, Vector2};
use std::{
cmp::Ordering,
@@ -109,6 +110,18 @@ impl From<Point2<i32>> for Point {
}
}
+impl From<XY<i32>> for Point {
+ fn from(point: XY<i32>) -> Self {
+ Point::new(point.x as f32, point.y as f32)
+ }
+}
+
+impl From<XY<f32>> for Point {
+ fn from(point: XY<f32>) -> Self {
+ Point::new(point.x, point.y)
+ }
+}
+
impl Add for Point {
type Output = Self;
diff --git a/svgbob/src/util.rs b/svgbob/src/util.rs
index 1ce68a3..4253c5f 100644
--- a/svgbob/src/util.rs
+++ b/svgbob/src/util.rs
@@ -1,8 +1,5 @@
use crate::Point;
-use ncollide2d::{
- bounding_volume::AABB, math::Isometry,
- query::point_internal::point_query::PointQuery,
-};
+use ncollide2d::{bounding_volume::AABB, math::Isometry, query::PointQuery};
use std::cmp::Ordering;
pub fn opt_ord(f1: Option<f32>, f2: Option<f32>) -> Ordering {
@@ -38,8 +35,8 @@ fn clip_line_internal(
let end_v = end.to_vector() - start_v;
let clipped = aabb.clip_line(&start, &end_v);
if let Some(clipped) = clipped {
- let a = *clipped.a();
- let b = *clipped.b();
+ let a = *clipped.a;
+ let b = *clipped.b;
Some((a.into(), b.into()))
} else {
None