From d4fe7977c78bbf6eb8a19b85d94d4b01161dafa0 Mon Sep 17 00:00:00 2001 From: Jovansonlee Cesar Date: Tue, 13 Jul 2021 03:14:29 +0800 Subject: Use the parry2d in the crate imports --- Architecture.md | 2 +- svgbob/Cargo.toml | 2 +- svgbob/TODO.md | 4 ++-- svgbob/src/buffer/cell_buffer/cell.rs | 4 ++-- svgbob/src/buffer/fragment_buffer/fragment.rs | 8 ++++---- svgbob/src/buffer/fragment_buffer/fragment/arc.rs | 2 +- svgbob/src/buffer/fragment_buffer/fragment/circle.rs | 4 ++-- svgbob/src/buffer/fragment_buffer/fragment/line.rs | 6 +++--- svgbob/src/buffer/fragment_buffer/fragment/polygon.rs | 4 ++-- svgbob/src/buffer/fragment_buffer/fragment/rect.rs | 4 ++-- svgbob/src/util.rs | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Architecture.md b/Architecture.md index 1ec10b6..9b8fe03 100644 --- a/Architecture.md +++ b/Architecture.md @@ -10,7 +10,7 @@ are then merged to form lines and arcs. The lines and arcs are then endorsed int Bob Ross - a painter who like to draws happy little trees. ### Library used -- [nalgebra](https://www.nalgebra.org/) and [ncollide2d](https://ncollide.org/) for geometric function calculations such as calculating whether lines are intersecting, collinear. Computing the clipping of lines and boxes. +- [nalgebra](https://www.nalgebra.org/) and [parry2d](https://parry.rs/) for geometric function calculations such as calculating whether lines are intersecting, collinear. Computing the clipping of lines and boxes. - [pom](https://github.com/J-F-Liu/pom) for parsing the styling directives(Legend) at the bottom of the document - [sauron](https://github.com/ivanceras/sauron) for building the svg document object tree. diff --git a/svgbob/Cargo.toml b/svgbob/Cargo.toml index d4da08e..3ad6f7b 100644 --- a/svgbob/Cargo.toml +++ b/svgbob/Cargo.toml @@ -11,7 +11,7 @@ license = "Apache-2.0" [dependencies] nalgebra = "0.28" -ncollide2d = { version = "0.6", package = "parry2d"} +parry2d = "0.6" lazy_static = "1.3.0" sauron = { version = "0.34" } unicode-width = "0.1.5" diff --git a/svgbob/TODO.md b/svgbob/TODO.md index 62f0a5e..22d98b4 100644 --- a/svgbob/TODO.md +++ b/svgbob/TODO.md @@ -19,9 +19,9 @@ - [ ] Clean the project enforce deny warnings. - [ ] Fix a bug where an escaped text has whitespaces, the whitespaces are gone. - [X] Revise calculation of Circle and Arc center by basing on the number of chars/width -- [ ] Add more circle art +- [ ] Add more circle art, dynamically created - [ ] Enhance quarter arc to be able to merge 2 or 3 quarters to form bigger arcs - [ ] Support for pills, elongated ovals -- [ ] Update to library to latest version +- [X] Update to library to latest version - nalgebra - ncollide2d -> parry2d diff --git a/svgbob/src/buffer/cell_buffer/cell.rs b/svgbob/src/buffer/cell_buffer/cell.rs index 079a7f7..0a5b82e 100644 --- a/svgbob/src/buffer/cell_buffer/cell.rs +++ b/svgbob/src/buffer/cell_buffer/cell.rs @@ -1,6 +1,6 @@ use crate::{util, Point}; -use ncollide2d::query::PointQuery; -use ncollide2d::{ +use parry2d::query::PointQuery; +use parry2d::{ bounding_volume::AABB, math::Isometry, query::intersection_test, diff --git a/svgbob/src/buffer/fragment_buffer/fragment.rs b/svgbob/src/buffer/fragment_buffer/fragment.rs index ae0b2b4..2080f5f 100644 --- a/svgbob/src/buffer/fragment_buffer/fragment.rs +++ b/svgbob/src/buffer/fragment_buffer/fragment.rs @@ -4,10 +4,10 @@ pub use arc::Arc; pub use circle::Circle; pub use line::Line; pub use marker_line::{Marker, MarkerLine}; -use ncollide2d::bounding_volume::BoundingVolume; -use ncollide2d::query::PointQuery; -use ncollide2d::shape::ConvexPolygon; -use ncollide2d::{ +use parry2d::bounding_volume::BoundingVolume; +use parry2d::query::PointQuery; +use parry2d::shape::ConvexPolygon; +use parry2d::{ bounding_volume::AABB, math::Isometry, query::intersection_test, diff --git a/svgbob/src/buffer/fragment_buffer/fragment/arc.rs b/svgbob/src/buffer/fragment_buffer/fragment/arc.rs index 5d7963e..dd9c81b 100644 --- a/svgbob/src/buffer/fragment_buffer/fragment/arc.rs +++ b/svgbob/src/buffer/fragment_buffer/fragment/arc.rs @@ -1,5 +1,5 @@ use crate::{buffer::Cell, fragment::Bounds, util, Point}; -use ncollide2d::shape::{Segment, Shape}; +use parry2d::shape::{Segment, Shape}; use sauron::{ html::attributes::*, svg::{attributes::*, *}, diff --git a/svgbob/src/buffer/fragment_buffer/fragment/circle.rs b/svgbob/src/buffer/fragment_buffer/fragment/circle.rs index 058b738..a77b44a 100644 --- a/svgbob/src/buffer/fragment_buffer/fragment/circle.rs +++ b/svgbob/src/buffer/fragment_buffer/fragment/circle.rs @@ -1,7 +1,7 @@ use crate::{fragment::Bounds, util, Cell, Point}; use nalgebra::Point2; -use ncollide2d::shape::ConvexPolygon; -use ncollide2d::shape::Polyline; +use parry2d::shape::ConvexPolygon; +use parry2d::shape::Polyline; use std::{cmp::Ordering, fmt}; use sauron::{ diff --git a/svgbob/src/buffer/fragment_buffer/fragment/line.rs b/svgbob/src/buffer/fragment_buffer/fragment/line.rs index 54c135b..a426f2e 100644 --- a/svgbob/src/buffer/fragment_buffer/fragment/line.rs +++ b/svgbob/src/buffer/fragment_buffer/fragment/line.rs @@ -3,9 +3,9 @@ use crate::{ fragment::{marker_line, Bounds, Circle, Marker, MarkerLine}, util, Direction, Point, }; -use ncollide2d::query::PointQuery; -use ncollide2d::{bounding_volume::AABB, shape::Polyline}; -use ncollide2d::{ +use parry2d::query::PointQuery; +use parry2d::{bounding_volume::AABB, shape::Polyline}; +use parry2d::{ math::Isometry, shape::{Segment, Shape}, }; diff --git a/svgbob/src/buffer/fragment_buffer/fragment/polygon.rs b/svgbob/src/buffer/fragment_buffer/fragment/polygon.rs index d2d0815..42814c1 100644 --- a/svgbob/src/buffer/fragment_buffer/fragment/polygon.rs +++ b/svgbob/src/buffer/fragment_buffer/fragment/polygon.rs @@ -4,7 +4,7 @@ use crate::{ Cell, Point, }; use nalgebra::Point2; -use ncollide2d::shape::{shape::Shape, Polyline}; +use parry2d::shape::{shape::Shape, Polyline}; use sauron::{ html::attributes::*, svg::{attributes::*, *}, @@ -169,7 +169,7 @@ impl Polygon { pub(crate) fn center(&self) -> Point { let points: Vec> = self.points.iter().map(|p| **p).collect(); - (ncollide2d::utils::center(&points)).into() + (parry2d::utils::center(&points)).into() } } diff --git a/svgbob/src/buffer/fragment_buffer/fragment/rect.rs b/svgbob/src/buffer/fragment_buffer/fragment/rect.rs index 0978bf4..7210c4a 100644 --- a/svgbob/src/buffer/fragment_buffer/fragment/rect.rs +++ b/svgbob/src/buffer/fragment_buffer/fragment/rect.rs @@ -1,6 +1,6 @@ use crate::{fragment::Bounds, util, Cell, Point}; -use ncollide2d::shape::ConvexPolygon; -use ncollide2d::shape::{Polyline, Segment, Shape}; +use parry2d::shape::ConvexPolygon; +use parry2d::shape::{Polyline, Segment, Shape}; use sauron::{ html::attributes::*, svg::{attributes::*, *}, diff --git a/svgbob/src/util.rs b/svgbob/src/util.rs index 499bf9f..226cfbf 100644 --- a/svgbob/src/util.rs +++ b/svgbob/src/util.rs @@ -1,6 +1,6 @@ use crate::Point; -use ncollide2d::shape::Triangle; -use ncollide2d::{bounding_volume::AABB, math::Isometry, query::PointQuery}; +use parry2d::shape::Triangle; +use parry2d::{bounding_volume::AABB, math::Isometry, query::PointQuery}; use std::cmp::Ordering; pub fn opt_ord(f1: Option, f2: Option) -> Ordering { -- cgit v1.2.3