Skip to content

New feature: "path effects" (simplify, offset)#171

Merged
vancluever merged 1 commit into
mainfrom
path-fx
May 5, 2026
Merged

New feature: "path effects" (simplify, offset)#171
vancluever merged 1 commit into
mainfrom
path-fx

Conversation

@vancluever

Copy link
Copy Markdown
Owner

This adds a new "path effects" (informally named) feature, providing the following two functions for transforming paths:

  • simplify: This function returns a new path set with any self-intersections removed from closed paths. An example would be a 5-point self-intersecting star; the outer 10-point path would be returned. Note that this differs from traditional polygon partitioning algorithms right now in that we don't return any of the sub-polygons that this might create (e.g., the pentagon or triangles in this instance), but we will split up any self-sealing polygons created (think a self-intersecting path creating two triangles). Additionally, this currently only accepts closed paths - open paths will be returned unchanged (although some things like co-linear points will be consolidated).

  • offset: This function returns a new path with all nodes offset by the supplied amount (negative values inset, positive values offset). The inside is determined by the direction of the path, particularly in the case of open paths, it is determined by the starting direction. While self-intersections will be processed, you will likely get undesirable results (hence why we give you simplify to help with this case).

@vancluever vancluever added the enhancement New feature or request label May 4, 2026
@vancluever vancluever force-pushed the path-fx branch 5 times, most recently from 0488f68 to c22bd1b Compare May 5, 2026 14:53
This adds a new "path effects" (informally named) feature, providing the
following two functions for transforming paths:

* simplify: This function returns a new path set with any
  self-intersections removed from closed paths. An example would be a
  5-point self-intersecting star; the outer 10-point path would be
  returned. Note that this differs from traditional polygon partitioning
  algorithms right now in that we don't return any of the sub-polygons
  that this might create (e.g., the pentagon or triangles in this
  instance), but we will split up any self-sealing polygons created
  (think a self-intersecting path creating two triangles). Additionally,
  this currently only accepts closed paths - open paths will be returned
  unchanged (although some things like co-linear points will be
  consolidated).

* offset: This function returns a new path with all nodes offset by the
  supplied amount (negative values inset, positive values offset). The
  inside is determined by the direction of the path, particularly in the
  case of open paths, it is determined by the starting direction. While
  self-intersections will be processed, you will likely get undesirable
  results (hence why we give you simplify to help with this case).
@vancluever vancluever merged commit a2e609d into main May 5, 2026
2 checks passed
@vancluever vancluever deleted the path-fx branch May 5, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant