Bezier-rs: Add lookup table function for subpath and make it support euclidean parameterization (#1082)

* Add euclidean option for lut

* Add lut for subpath

* Fix rust formatting

* Fixed breakages caused by UI updates

* Code cleanup

* Make ProjectionOptions optional

---------

Co-authored-by: Rob Nadal <robnadal44@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Linda Zheng
2023-03-27 18:05:00 -07:00
committed by GitHub
co-authored by Rob Nadal Keavon Chambers
parent 508726d73f
commit f49e62a51c
11 changed files with 99 additions and 37 deletions
@@ -76,10 +76,11 @@ const bezierFeatures = {
},
"lookup-table": {
name: "Lookup Table",
callback: (bezier: WasmBezierInstance, options: Record<string, number>): string => bezier.compute_lookup_table(options.steps),
callback: (bezier: WasmBezierInstance, options: Record<string, number>, _: undefined): string => bezier.compute_lookup_table(options.steps, BEZIER_T_VALUE_VARIANTS[options.TVariant]),
demoOptions: {
Quadratic: {
inputOptions: [
bezierTValueVariantOptions,
{
min: 2,
max: 15,
@@ -20,6 +20,20 @@ const subpathFeatures = {
callback: (subpath: WasmSubpathInstance, options: Record<string, number>, _: undefined): string => subpath.evaluate(options.t, SUBPATH_T_VALUE_VARIANTS[options.TVariant]),
inputOptions: [subpathTValueVariantOptions, tSliderOptions],
},
"lookup-table": {
name: "Lookup Table",
callback: (subpath: WasmSubpathInstance, options: Record<string, number>, _: undefined): string => subpath.compute_lookup_table(options.steps, SUBPATH_T_VALUE_VARIANTS[options.TVariant]),
inputOptions: [
subpathTValueVariantOptions,
{
min: 2,
max: 30,
step: 1,
default: 5,
variable: "steps",
},
],
},
project: {
name: "Project",
callback: (subpath: WasmSubpathInstance, _: Record<string, number>, mouseLocation?: [number, number]): string =>