New nodes: Resample Points, Spline from Points (#1226)

* Create node (no implementation)

* Resampling - WIP

* use bezier::from_linear_dvec2

* Use from anchors instead of Bezier

* Tidy up anchor collection & subpath creation

* Add Spline from Points node (not implemented)

* Add spline from points node implementation

* Update resampling

* Update minimum density 0.01 -> 1.0

* Add a way to create a custom vector network

* Add spline from points node to spline tool

* Fix crash when no points

* Add anchor method to subpath

* Exact start and end point

* Fix compile errors from rebase

* Fix spline tool

* Rename 'Density' to 'Spacing'

* Fix transforms

* Only close subpaths with >1 anchor

* Fix compile

* Fix compile error

* Fix from points with many subpaths

* Fix new_cubic_spline crash with one point

* Rename to resample as polyline

* Fix div zero

* Fix missing file

* Fix resample

* Rename to resample points

---------

Co-authored-by: hypercube <0hypercube@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Chase
2023-08-30 05:21:39 -07:00
committed by GitHub
co-authored by hypercube Keavon Chambers
parent 3419e739af
commit 5acb2cff06
7 changed files with 94 additions and 3 deletions
+7
View File
@@ -6,6 +6,13 @@ use super::*;
impl Bezier {
/// Convert a euclidean distance ratio along the `Bezier` curve to a parametric `t`-value.
pub fn euclidean_to_parametric(&self, ratio: f64, error: f64) -> f64 {
if ratio < error {
return 0.;
}
if 1. - ratio < error {
return 1.;
}
let mut low = 0.;
let mut mid = 0.;
let mut high = 1.;