mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 19:28:12 +08:00
Bezier-rs: Add SubpathTValue and euclidean parameterization for subpaths (#1027)
* Added SubpathTValue and euclidean parameterization for subpaths * Small fix * Added bounds checking to get_segment * Code review * code review nit for clarity --------- Co-authored-by: Hannah Li <hannahli2010@gmail.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Hannah Li
Keavon Chambers
parent
344f243432
commit
9a52cae9b9
@@ -18,6 +18,16 @@ pub enum TValue {
|
||||
EuclideanWithinError { t: f64, error: f64 },
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub enum SubpathTValue {
|
||||
Parametric { segment_index: usize, t: f64 },
|
||||
GlobalParametric(f64),
|
||||
Euclidean { segment_index: usize, t: f64 },
|
||||
GlobalEuclidean(f64),
|
||||
EuclideanWithinError { segment_index: usize, t: f64, error: f64 },
|
||||
GlobalEuclideanWithinError { t: f64, error: f64 },
|
||||
}
|
||||
|
||||
/// Helper to perform the computation of a and c, where b is the provided point on the curve.
|
||||
/// Given the correct power of `t` and `(1-t)`, the computation is the same for quadratic and cubic cases.
|
||||
/// Relevant derivation and the definitions of a, b, and c can be found in [the projection identity section](https://pomax.github.io/bezierinfo/#abc) of Pomax's bezier curve primer.
|
||||
|
||||
Reference in New Issue
Block a user