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:
Rob Nadal
2023-02-17 15:33:52 -05:00
committed by GitHub
co-authored by Hannah Li Keavon Chambers
parent 2291f7e7d6
commit f241ef3ff6
10 changed files with 334 additions and 247 deletions
@@ -10,8 +10,7 @@ const subpathFeatures = {
name: "Insert",
callback: (subpath: WasmSubpathInstance, options: Record<string, number>, _: undefined, tVariant: TVariant): string => subpath.insert(options.t, tVariant),
sliderOptions: [tSliderOptions],
// TODO: Uncomment this after implementing the Euclidean version
// chooseTVariant: true,
chooseTVariant: true,
},
length: {
name: "Length",
@@ -31,13 +30,15 @@ const subpathFeatures = {
},
tangent: {
name: "Tangent",
callback: (subpath: WasmSubpathInstance, options: Record<string, number>): string => subpath.tangent(options.t),
callback: (subpath: WasmSubpathInstance, options: Record<string, number>, _: undefined, tVariant: TVariant): string => subpath.tangent(options.t, tVariant),
sliderOptions: [tSliderOptions],
chooseTVariant: true,
},
normal: {
name: "Normal",
callback: (subpath: WasmSubpathInstance, options: Record<string, number>): string => subpath.normal(options.t),
callback: (subpath: WasmSubpathInstance, options: Record<string, number>, _: undefined, tVariant: TVariant): string => subpath.normal(options.t, tVariant),
sliderOptions: [tSliderOptions],
chooseTVariant: true,
},
"intersect-linear": {
name: "Intersect (Line Segment)",
@@ -70,8 +71,7 @@ const subpathFeatures = {
name: "Split",
callback: (subpath: WasmSubpathInstance, options: Record<string, number>, _: undefined, tVariant: TVariant): string => subpath.split(options.t, tVariant),
sliderOptions: [tSliderOptions],
// TODO: Uncomment this after implementing the Euclidean version
// chooseTVariant: true,
chooseTVariant: true,
},
};