Bezier-rs: Updated Bezier function signatures to accept TValue (#967)

* Create helper for converting d to t values

* Add euclidean option for tangent and normal

* Modified bezier functions signatures to accept ComputeType

* Stylistic changes per review

* Added ComputeType documentation

* Renamed ComputeType to TValue

* Fixed comments

* Fixed failing unit tests

* Code review

* Fix comments in code review

* Renamed compute_type_to_parametric to t_value_to_parametric

---------

Co-authored-by: Linda Zheng <thelindazheng@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Rob Nadal
2023-02-13 12:31:51 -05:00
committed by GitHub
co-authored by Linda Zheng Keavon Chambers
parent 1c2b8f67b2
commit 76be1f8515
25 changed files with 456 additions and 433 deletions
@@ -1,6 +1,6 @@
import subpathFeatures, { SubpathFeatureKey } from "@/features/subpath-features";
import { renderDemoPane } from "@/utils/render";
import { ComputeType, Demo, DemoPane, SliderOption, SubpathDemoArgs } from "@/utils/types";
import { TVariant, Demo, DemoPane, SliderOption, SubpathDemoArgs } from "@/utils/types";
class SubpathDemoPane extends HTMLElement implements DemoPane {
// Props
@@ -12,14 +12,14 @@ class SubpathDemoPane extends HTMLElement implements DemoPane {
triggerOnMouseMove!: boolean;
chooseComputeType!: boolean;
chooseTVariant!: boolean;
// Data
demos!: SubpathDemoArgs[];
id!: string;
computeType!: ComputeType;
tVariant!: TVariant;
connectedCallback(): void {
this.demos = [
@@ -47,14 +47,13 @@ class SubpathDemoPane extends HTMLElement implements DemoPane {
closed: true,
},
];
this.computeType = "Parametric";
this.tVariant = "Parametric";
this.key = (this.getAttribute("name") || "") as SubpathFeatureKey;
this.id = `subpath/${this.key}`;
this.name = subpathFeatures[this.key].name;
this.sliderOptions = JSON.parse(this.getAttribute("sliderOptions") || "[]");
this.triggerOnMouseMove = this.getAttribute("triggerOnMouseMove") === "true";
this.chooseComputeType = this.getAttribute("chooseComputeType") === "true";
this.chooseTVariant = this.getAttribute("chooseTVariant") === "true";
this.render();
}
@@ -71,7 +70,7 @@ class SubpathDemoPane extends HTMLElement implements DemoPane {
subpathDemo.setAttribute("key", this.key);
subpathDemo.setAttribute("sliderOptions", JSON.stringify(this.sliderOptions));
subpathDemo.setAttribute("triggerOnMouseMove", String(this.triggerOnMouseMove));
subpathDemo.setAttribute("computetype", this.computeType);
subpathDemo.setAttribute("tvariant", this.tVariant);
return subpathDemo;
}
}