mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 01:18:12 +08:00
Update dependencies and lock files (#1841)
* Bump lock files * Fix glam mismatch version * Add tokio feature * Update all deps * Fix gpu-compiler not able to reference the root workspace * Bump a few more deps --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
ab71d26d84
commit
fa1535d0bb
@@ -15,7 +15,7 @@ documentation = "https://graphite.rs/libraries/bezier-rs/"
|
||||
|
||||
[dependencies]
|
||||
# Required dependencies
|
||||
glam = { version = "0.25", features = ["serde"] }
|
||||
glam = { version = "0.28", features = ["serde"] }
|
||||
|
||||
# Optional local dependencies
|
||||
dyn-any = { version = "0.3.0", path = "../dyn-any", optional = true }
|
||||
|
||||
@@ -273,7 +273,7 @@ impl Bezier {
|
||||
BezierHandles::Cubic { .. } => {
|
||||
// Axis align the curve.
|
||||
let translated_bezier = self.translate(-self.start);
|
||||
let angle = translated_bezier.end.angle_between(DVec2::new(1., 0.));
|
||||
let angle = translated_bezier.end.angle_to(DVec2::new(1., 0.));
|
||||
let rotated_bezier = translated_bezier.rotate(angle);
|
||||
if let BezierHandles::Cubic { handle_start, handle_end } = rotated_bezier.handles {
|
||||
// These formulas and naming conventions follows https://pomax.github.io/bezierinfo/#inflections
|
||||
@@ -413,7 +413,7 @@ impl Bezier {
|
||||
if other.is_linear() {
|
||||
// Rotate the bezier and the line by the angle that the line makes with the x axis
|
||||
let line_directional_vector = other.end - other.start;
|
||||
let angle = line_directional_vector.angle_between(DVec2::new(0., 1.));
|
||||
let angle = line_directional_vector.angle_to(DVec2::new(0., 1.));
|
||||
let rotation_matrix = DMat2::from_angle(angle);
|
||||
let rotated_bezier = self.apply_transformation(|point| rotation_matrix * point);
|
||||
|
||||
@@ -452,7 +452,7 @@ impl Bezier {
|
||||
/// If this needs to be called frequently with a line of the same rotation angle, consider instead using [`line_test_crossings_prerotated`] and moving this function's setup code into your own logic before the repeated call.
|
||||
pub fn line_test_crossings(&self, point_on_line: DVec2, direction_vector: DVec2) -> impl Iterator<Item = f64> + '_ {
|
||||
// Rotate the bezier and the line by the angle that the line makes with the x axis
|
||||
let angle = direction_vector.angle_between(DVec2::new(0., 1.));
|
||||
let angle = direction_vector.angle_to(DVec2::new(0., 1.));
|
||||
let rotation_matrix = DMat2::from_angle(angle);
|
||||
let rotated_bezier = self.apply_transformation(|point| rotation_matrix * point);
|
||||
|
||||
@@ -476,7 +476,7 @@ impl Bezier {
|
||||
/// If this needs to be called frequently with a ray of the same rotation angle, consider instead using [`ray_test_crossings_prerotated`] and moving this function's setup code into your own logic before the repeated call.
|
||||
pub fn ray_test_crossings(&self, ray_start: DVec2, ray_direction: DVec2) -> impl Iterator<Item = f64> + '_ {
|
||||
// Rotate the bezier and the line by the angle that the line makes with the x axis
|
||||
let angle = ray_direction.angle_between(DVec2::new(0., 1.));
|
||||
let angle = ray_direction.angle_to(DVec2::new(0., 1.));
|
||||
let rotation_matrix = DMat2::from_angle(angle);
|
||||
let rotated_bezier = self.apply_transformation(|point| rotation_matrix * point);
|
||||
|
||||
|
||||
@@ -140,8 +140,8 @@ impl Bezier {
|
||||
}
|
||||
// Verify all the handles are located on a single side of the curve.
|
||||
if let BezierHandles::Cubic { handle_start, handle_end } = self.handles {
|
||||
let angle_1 = (self.end - self.start).angle_between(handle_start - self.start);
|
||||
let angle_2 = (self.end - self.start).angle_between(handle_end - self.start);
|
||||
let angle_1 = (self.end - self.start).angle_to(handle_start - self.start);
|
||||
let angle_2 = (self.end - self.start).angle_to(handle_end - self.start);
|
||||
if (angle_1 > 0. && angle_2 < 0.) || (angle_1 < 0. && angle_2 > 0.) {
|
||||
return false;
|
||||
}
|
||||
@@ -533,9 +533,9 @@ impl Bezier {
|
||||
let center = wrapped_center.unwrap();
|
||||
let radius = center.distance(p1);
|
||||
|
||||
let angle_p1 = DVec2::new(1., 0.).angle_between(p1 - center);
|
||||
let angle_p2 = DVec2::new(1., 0.).angle_between(p2 - center);
|
||||
let angle_p3 = DVec2::new(1., 0.).angle_between(p3 - center);
|
||||
let angle_p1 = DVec2::new(1., 0.).angle_to(p1 - center);
|
||||
let angle_p2 = DVec2::new(1., 0.).angle_to(p2 - center);
|
||||
let angle_p3 = DVec2::new(1., 0.).angle_to(p3 - center);
|
||||
|
||||
let mut start_angle = angle_p1;
|
||||
let mut end_angle = angle_p3;
|
||||
|
||||
@@ -377,7 +377,7 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
|
||||
// Draw the miter join if the intersection occurs in the correct direction with respect to the path
|
||||
if start_to_intersection.normalize().abs_diff_eq(in_tangent, MAX_ABSOLUTE_DIFFERENCE)
|
||||
&& intersection_to_end.normalize().abs_diff_eq(out_tangent, MAX_ABSOLUTE_DIFFERENCE)
|
||||
&& miter_limit >= 1. / (start_to_intersection.angle_between(-intersection_to_end).abs() / 2.).sin()
|
||||
&& miter_limit >= 1. / (start_to_intersection.angle_to(-intersection_to_end).abs() / 2.).sin()
|
||||
{
|
||||
return Some(ManipulatorGroup {
|
||||
anchor: intersection,
|
||||
@@ -406,10 +406,10 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
|
||||
let in_segment = self.get_segment(self.len_segments() - 1).unwrap();
|
||||
let in_tangent = in_segment.tangent(TValue::Parametric(1.));
|
||||
|
||||
let mut angle = center_to_right.angle_between(center_to_left) / 2.;
|
||||
let mut angle = center_to_right.angle_to(center_to_left) / 2.;
|
||||
let mut arc_point = center + DMat2::from_angle(angle).mul_vec2(center_to_right);
|
||||
|
||||
if (arc_point - left).angle_between(in_tangent).abs() > PI / 2. {
|
||||
if (arc_point - left).angle_to(in_tangent).abs() > PI / 2. {
|
||||
angle = angle - PI * (if angle < 0. { -1. } else { 1. });
|
||||
arc_point = center + DMat2::from_angle(angle).mul_vec2(center_to_right);
|
||||
}
|
||||
@@ -874,8 +874,8 @@ mod tests {
|
||||
|
||||
let middle = (round_start + round_end) / 2.;
|
||||
|
||||
assert!((round_point - middle).angle_between(round_start - middle) > 0.);
|
||||
assert!((round_end - middle).angle_between(round_point - middle) > 0.);
|
||||
assert!((round_point - middle).angle_to(round_start - middle) > 0.);
|
||||
assert!((round_end - middle).angle_to(round_point - middle) > 0.);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -915,7 +915,7 @@ mod tests {
|
||||
|
||||
let middle = (round_start + round_end) / 2.;
|
||||
|
||||
assert!((round_point - middle).angle_between(round_start - middle) < 0.);
|
||||
assert!((round_end - middle).angle_between(round_point - middle) < 0.);
|
||||
assert!((round_point - middle).angle_to(round_start - middle) < 0.);
|
||||
assert!((round_end - middle).angle_to(round_point - middle) < 0.);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
|
||||
// Calculate the angle formed between two consecutive Subpaths
|
||||
let out_tangent = self.get_segment(i).unwrap().tangent(TValue::Parametric(1.));
|
||||
let in_tangent = self.get_segment(j).unwrap().tangent(TValue::Parametric(0.));
|
||||
let angle = out_tangent.angle_between(in_tangent);
|
||||
let angle = out_tangent.angle_to(in_tangent);
|
||||
|
||||
// The angle is concave. The Subpath overlap and must be clipped
|
||||
let mut apply_join = true;
|
||||
@@ -428,7 +428,7 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
|
||||
if self.closed {
|
||||
let out_tangent = self.get_segment(self.len_segments() - 1).unwrap().tangent(TValue::Parametric(1.));
|
||||
let in_tangent = self.get_segment(0).unwrap().tangent(TValue::Parametric(0.));
|
||||
let angle = out_tangent.angle_between(in_tangent);
|
||||
let angle = out_tangent.angle_to(in_tangent);
|
||||
|
||||
let mut apply_join = true;
|
||||
if (angle > 0. && distance > 0.) || (angle < 0. && distance < 0.) {
|
||||
|
||||
@@ -29,7 +29,7 @@ dyn-any-derive = { path = "derive", optional = true }
|
||||
|
||||
# Optional dependencies
|
||||
log = { version = "0.4", optional = true }
|
||||
glam = { version = "0.25", optional = true, default-features = false }
|
||||
glam = { version = "0.28", optional = true, default-features = false }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
||||
Reference in New Issue
Block a user