Bezier-rs: Added curve outline functions (#789)

* Implement offset and reverse

Co-authored-by: Rob Nadal <robnadal44@gmail.com>

* Initial work on graduated outline

Co-authored-by: Rob Nadal <robnadal44@gmail.com>

* Handle linear case for graduated scale

* Added skewed outline, fixed graduated scale hourglass bug

* Removed test code

* Update comments

* Fix linting issue

* Improve comments

* Comment fixes

Co-authored-by: Hannah Li <hannahli2010@gmail.com>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Rob Nadal
2022-11-06 21:25:00 -08:00
committed by GitHub
co-authored by Hannah Li Keavon Chambers
parent b7ed54a336
commit bb2dd5a259
6 changed files with 321 additions and 5 deletions
+80
View File
@@ -295,6 +295,86 @@ export default defineComponent({
},
},
},
{
name: "Outline",
callback: (bezier: WasmBezierInstance, options: Record<string, number>): string => bezier.outline(options.distance),
exampleOptions: {
[BezierCurveType.Quadratic]: {
sliderOptions: [
{
variable: "distance",
min: 0,
max: 50,
step: 1,
default: 20,
},
],
},
},
},
{
name: "Graduated Outline",
callback: (bezier: WasmBezierInstance, options: Record<string, number>): string => bezier.graduated_outline(options.start_distance, options.end_distance),
exampleOptions: {
[BezierCurveType.Quadratic]: {
sliderOptions: [
{
variable: "start_distance",
min: 0,
max: 50,
step: 1,
default: 30,
},
{
variable: "end_distance",
min: 0,
max: 50,
step: 1,
default: 30,
},
],
},
},
},
{
name: "Skewed Outline",
callback: (bezier: WasmBezierInstance, options: Record<string, number>): string =>
bezier.skewed_outline(options.distance1, options.distance2, options.distance3, options.distance4),
exampleOptions: {
[BezierCurveType.Quadratic]: {
sliderOptions: [
{
variable: "distance1",
min: 0,
max: 50,
step: 1,
default: 20,
},
{
variable: "distance2",
min: 0,
max: 50,
step: 1,
default: 10,
},
{
variable: "distance3",
min: 0,
max: 50,
step: 1,
default: 30,
},
{
variable: "distance4",
min: 0,
max: 50,
step: 1,
default: 5,
},
],
},
},
},
{
name: "Arcs",
callback: (bezier: WasmBezierInstance, options: Record<string, number>): string => bezier.arcs(options.error, options.max_iterations, options.strategy),