-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Is your feature request related to a problem? Please describe.
I like this repo.
It seems better in terms of perf, accuracy and flexibility than other alternatives I have worked with (mainly bezier-js
).
I use path intersection a lot and in many cases where intersection is tested on paths that do not change a lot.
Therefore, it seems a perf hit to parse these paths every time, especially since perf is a big deal for my use case (area selection or rendering).
I might be wrong but it seems this is the case in the source code. It seems parsing occurs on every call.
Additionally, I would argue that a consumer of this repo will need the path parsed for other usages (path length, getting t or segment by t, calculating bbox) and will probably use other repos for that.
Reducing parsing in runtime sounds ideal.
Describe the solution you'd like
I suggest exposing a signature that receives parsed paths and a signature to parse them.
This doesn't have to be breaking.
Or even better:
export type ParsedPath = ...
export function findPathIntersections(path1: Path | ParsedPath, path2: Path | ParsedPath, justCount?: boolean): Intersection[] | number;
Describe alternatives you've considered
Patching locally or forking