Skip to content

Commit 6abe6fb

Browse files
committed
Code review
1 parent c59d598 commit 6abe6fb

11 files changed

Lines changed: 15 additions & 27 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ graphite-editor = { opt-level = 1 }
189189
graphene-core-shaders = { opt-level = 1 }
190190
graphene-core = { opt-level = 1 }
191191
graphene-std = { opt-level = 1 }
192-
interpreted-executor = { opt-level = 1 } # This is a mitigation for https://github.com/rustwasm/wasm-pack/issues/981 which is needed because the node_registry function is too large
192+
interpreted-executor = { opt-level = 1 } # This is a mitigation for https://github.com/rustwasm/wasm-pack/issues/981 which is needed because the node_registry function is too large
193193
graphite-proc-macros = { opt-level = 1 }
194194
image = { opt-level = 2 }
195195
rustc-hash = { opt-level = 3 }

node-graph/gcore/src/math/math_ext.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
use kurbo::{Line, PathSeg};
2-
31
use crate::math::quad::Quad;
42
use crate::math::rect::Rect;
53
use crate::subpath::Bezier;
64
use crate::vector::misc::dvec2_to_point;
5+
use kurbo::{Line, PathSeg};
76

87
pub trait QuadExt {
98
/// Get all the edges in the rect as linear bezier curves

node-graph/gcore/src/math/polynomial.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
use kurbo::PathSeg;
12
use std::fmt::{self, Display, Formatter};
23
use std::ops::{Add, AddAssign, Mul, MulAssign, Neg, Sub, SubAssign};
34

4-
use kurbo::PathSeg;
5-
65
/// A struct that represents a polynomial with a maximum degree of `N-1`.
76
///
87
/// It provides basic mathematical operations for polynomials like addition, multiplication, differentiation, integration, etc.

node-graph/gcore/src/subpath/core.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use crate::vector::misc::point_to_dvec2;
2-
31
use super::consts::*;
42
use super::*;
3+
use crate::vector::misc::point_to_dvec2;
54
use glam::DVec2;
65
use kurbo::PathSeg;
76

node-graph/gcore/src/subpath/lookup.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
use crate::{
2-
math::polynomial::pathseg_to_parametric_polynomial,
3-
vector::algorithms::bezpath_algorithms::pathseg_length_centroid_and_length,
4-
vector::algorithms::intersection::{filtered_all_segment_intersections, pathseg_self_intersections},
5-
};
6-
7-
use super::{consts::MAX_ABSOLUTE_DIFFERENCE, *};
1+
use super::consts::MAX_ABSOLUTE_DIFFERENCE;
2+
use super::*;
3+
use crate::math::polynomial::pathseg_to_parametric_polynomial;
4+
use crate::vector::algorithms::bezpath_algorithms::pathseg_length_centroid_and_length;
5+
use crate::vector::algorithms::intersection::{filtered_all_segment_intersections, pathseg_self_intersections};
86
use glam::DVec2;
97

108
impl<PointId: Identifier> Subpath<PointId> {

node-graph/gcore/src/subpath/solvers.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::subpath::{Identifier, Subpath};
2-
use crate::vector::{algorithms::bezpath_algorithms::bezpath_is_inside_bezpath, misc::dvec2_to_point};
3-
2+
use crate::vector::algorithms::bezpath_algorithms::bezpath_is_inside_bezpath;
3+
use crate::vector::misc::dvec2_to_point;
44
use glam::DVec2;
55
use kurbo::{Affine, BezPath, Shape};
66

@@ -40,13 +40,11 @@ impl<PointId: Identifier> Subpath<PointId> {
4040
}
4141

4242
/// Returns `true` if this subpath is completely inside the `other` subpath.
43-
/// <iframe frameBorder="0" width="100%" height="350px" src="https://graphite.rs/libraries/bezier-rs#subpath/inside-other/solo" title="Inside Other Subpath Demo"></iframe>
4443
pub fn is_inside_subpath(&self, other: &Subpath<PointId>, accuracy: Option<f64>, minimum_separation: Option<f64>) -> bool {
4544
bezpath_is_inside_bezpath(&self.to_bezpath(), &other.to_bezpath(), accuracy, minimum_separation)
4645
}
4746

4847
/// Return the min and max corners that represent the bounding box of the subpath. Return `None` if the subpath is empty.
49-
/// <iframe frameBorder="0" width="100%" height="300px" src="https://graphite.rs/libraries/bezier-rs#subpath/bounding-box/solo" title="Bounding Box Demo"></iframe>
5048
pub fn bounding_box(&self) -> Option<[DVec2; 2]> {
5149
self.iter()
5250
.map(|bezier| bezier.bounding_box())

node-graph/gcore/src/subpath/structs.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::vector::algorithms::intersection::filtered_segment_intersections;
22
use crate::vector::misc::{dvec2_to_point, handles_to_segment};
3-
43
use glam::{DAffine2, DVec2};
54
use kurbo::{CubicBez, Line, PathSeg, QuadBez, Shape};
65
use std::fmt::{Debug, Formatter, Result};
@@ -356,7 +355,6 @@ impl Bezier {
356355
}
357356

358357
/// Create a linear bezier using the provided DVec2s as the start and end points.
359-
/// <iframe frameBorder="0" width="100%" height="300px" src="https://graphite.rs/libraries/bezier-rs#bezier/constructor/solo" title="Constructor Demo"></iframe>
360358
pub fn from_linear_dvec2(p1: DVec2, p2: DVec2) -> Self {
361359
Bezier {
362360
start: p1,

node-graph/gcore/src/subpath/transform.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ impl<PointId: Identifier> Subpath<PointId> {
3939
}
4040

4141
/// Returns a subpath that results from rotating this subpath around the origin by the given angle (in radians).
42-
/// <iframe frameBorder="0" width="100%" height="325px" src="https://graphite.rs/libraries/bezier-rs#subpath/rotate/solo" title="Rotate Demo"></iframe>
4342
pub fn rotate(&self, angle: f64) -> Subpath<PointId> {
4443
let mut rotated_subpath = self.clone();
4544

node-graph/gcore/src/vector/algorithms/bezpath_algorithms.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ pub const DEFAULT_LUT_STEP_SIZE: usize = 10;
194194

195195
/// Return a selection of equidistant points on the bezier curve.
196196
/// If no value is provided for `steps`, then the function will default `steps` to be 10.
197-
/// <iframe frameBorder="0" width="100%" height="350px" src="https://graphite.rs/libraries/bezier-rs#bezier/lookup-table/solo" title="Lookup-Table Demo"></iframe>
198197
pub fn pathseg_compute_lookup_table(segment: PathSeg, steps: Option<usize>, eucliean: bool) -> impl Iterator<Item = DVec2> {
199198
let steps = steps.unwrap_or(DEFAULT_LUT_STEP_SIZE);
200199

node-graph/gcore/src/vector/click_target.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1+
use super::algorithms::intersection::filtered_segment_intersections;
2+
use super::misc::dvec2_to_point;
13
use crate::math::math_ext::QuadExt;
24
use crate::math::quad::Quad;
35
use crate::subpath::Subpath;
46
use crate::vector::PointId;
7+
use crate::vector::misc::point_to_dvec2;
58
use glam::{DAffine2, DMat2, DVec2};
69
use kurbo::{Affine, ParamCurve, PathSeg, Point, Shape};
710

8-
use super::algorithms::intersection::filtered_segment_intersections;
9-
use super::misc::dvec2_to_point;
10-
use crate::vector::misc::point_to_dvec2;
11-
1211
#[derive(Copy, Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
1312
pub struct FreePoint {
1413
pub id: PointId,

0 commit comments

Comments
 (0)