mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Upgrade and document the math operation nodes
This commit is contained in:
@@ -366,11 +366,15 @@ impl<PointId: crate::Identifier> Subpath<PointId> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Solve for the first handle of an open spline. (The opposite handle can be found by mirroring the result about the anchor.)
|
||||
pub fn solve_spline_first_handle_open(points: &[DVec2]) -> Vec<DVec2> {
|
||||
let len_points = points.len();
|
||||
if len_points == 0 {
|
||||
return Vec::new();
|
||||
}
|
||||
if len_points == 1 {
|
||||
return vec![points[0]];
|
||||
}
|
||||
|
||||
// Matrix coefficients a, b and c (see https://mathworld.wolfram.com/CubicSpline.html).
|
||||
// Because the `a` coefficients are all 1, they need not be stored.
|
||||
@@ -418,6 +422,8 @@ pub fn solve_spline_first_handle_open(points: &[DVec2]) -> Vec<DVec2> {
|
||||
d
|
||||
}
|
||||
|
||||
/// Solve for the first handle of a closed spline. (The opposite handle can be found by mirroring the result about the anchor.)
|
||||
/// If called with fewer than 3 points, this function will return an empty result.
|
||||
pub fn solve_spline_first_handle_closed(points: &[DVec2]) -> Vec<DVec2> {
|
||||
let len_points = points.len();
|
||||
if len_points < 3 {
|
||||
|
||||
Reference in New Issue
Block a user