mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-26 09:48:13 +08:00
Implement function to find inflection points of a Bezier curve (#712)
* Implement inflection function for bezier-rs * Swapped to explicit inflection formula Co-authored-by: Linda Zheng <ll2zheng@uwaterloo.ca> * Address Rob's comments * Fix axis align Co-authored-by: Linda Zheng <linda-zheng@users.noreply.github.com> * Address Keavon's comments * Fix linting Co-authored-by: Robert Nadal <Robnadal44@gmail.com> Co-authored-by: Hannah Li <hannahli2010@gmail.com> Co-authored-by: Linda Zheng <linda-zheng@users.noreply.github.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Linda Zheng
Linda Zheng
Robert Nadal
Hannah Li
Keavon Chambers
parent
a5bb153dab
commit
06524bac8d
@@ -369,6 +369,18 @@ export default defineComponent({
|
||||
drawLine(context, maxPoint, { x: maxPoint.x, y: minPoint.y }, COLORS.NON_INTERACTIVE.STROKE_1);
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Inflections",
|
||||
callback: (canvas: HTMLCanvasElement, bezier: WasmBezierInstance): void => {
|
||||
const context = getContextFromCanvas(canvas);
|
||||
const inflections: number[] = JSON.parse(bezier.inflections());
|
||||
inflections.forEach((t) => {
|
||||
const point = JSON.parse(bezier.evaluate(t));
|
||||
drawPoint(context, point, 4, COLORS.NON_INTERACTIVE.STROKE_1);
|
||||
});
|
||||
},
|
||||
curveDegrees: new Set([BezierCurveType.Cubic]),
|
||||
},
|
||||
],
|
||||
subpathFeatures: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user