mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 21:37:59 +00:00
Upgrade and document the math operation nodes
This commit is contained in:
parent
de366f9514
commit
d649052255
5 changed files with 148 additions and 62 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue