mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-20 03:18:06 +08:00
Upgrade to the Rust 2024 edition (#2367)
* Update to rust 2024 edition * Fixes * Clean up imports * Cargo fmt again --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -9,13 +9,12 @@
|
||||
//! The implementations in this module closely follow the SVG path specification,
|
||||
//! making it suitable for use in vector graphics applications.
|
||||
|
||||
use crate::EPS;
|
||||
use crate::aabb::{Aabb, bounding_box_around_point, expand_bounding_box, extend_bounding_box, merge_bounding_boxes};
|
||||
use crate::math::{lerp, vector_angle};
|
||||
use glam::{DMat2, DMat3, DVec2};
|
||||
use std::f64::consts::{PI, TAU};
|
||||
|
||||
use crate::aabb::{bounding_box_around_point, expand_bounding_box, extend_bounding_box, merge_bounding_boxes, Aabb};
|
||||
use crate::math::{lerp, vector_angle};
|
||||
use crate::EPS;
|
||||
|
||||
/// Represents a segment of a path in a 2D space, based on the SVG path specification.
|
||||
///
|
||||
/// This enum closely follows the path segment types defined in the SVG 2 specification.
|
||||
@@ -155,11 +154,7 @@ impl PathSegment {
|
||||
let b = 6. * b;
|
||||
let numerator = a.x * b.y - a.y * b.x;
|
||||
let denominator = a.length_squared() * a.length();
|
||||
if denominator == 0. {
|
||||
0.
|
||||
} else {
|
||||
numerator / denominator
|
||||
}
|
||||
if denominator == 0. { 0. } else { numerator / denominator }
|
||||
}
|
||||
PathSegment::Quadratic(start, control, end) => {
|
||||
// First derivative
|
||||
@@ -168,11 +163,7 @@ impl PathSegment {
|
||||
let b = 2. * (start - 2. * control + end);
|
||||
let numerator = a.x * b.y - a.y * b.x;
|
||||
let denominator = a.length_squared() * a.length();
|
||||
if denominator == 0. {
|
||||
0.
|
||||
} else {
|
||||
numerator / denominator
|
||||
}
|
||||
if denominator == 0. { 0. } else { numerator / denominator }
|
||||
}
|
||||
PathSegment::Arc(..) => self.arc_segment_to_cubics(0.001)[0].start_curvature(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user