Open justvanrossum opened 11 months ago
Option three may be the simplest thing to do:
diff --git a/src/bezier.js b/src/bezier.js
index 20b61b3..2d6aa3d 100644
--- a/src/bezier.js
+++ b/src/bezier.js
@@ -295,9 +295,10 @@ class Bezier {
ft = t;
}
}
- ft = ft < 0 ? 0 : ft > 1 ? 1 : ft;
- p = this.compute(ft);
- p.t = ft;
+ t = ft < 0 ? 0 : ft > 1 ? 1 : ft;
+ p = this.compute(t);
+ p.t = t;
+ p.ft = ft;
p.d = mdist;
return p;
}
I'm open to a PR but only if that functionality is controlled by an argument flag, i.e. project(uncapped = true)
.
I'd like to implement a version of
bezier.project()
, that doesn't clampft
between 0 and 1, but will return a null or undefined result whenft
is out of bounds.My first idea was to subclass Bezier, and add my own method, which would be mostly a copy of
project()
. However,project()
usesutils
, which isn't exported.If you're open to a PR that would make this possible, what would be the best way? I see some options:
utils
strict
argument toproject()
that does what I needft
value as a property to the resultingp
objectIf you see a different way how I could implement what I need, I'd be all ears.
Thanks for your consideration.