Skip to main content

Path.trim()

The Path.trim() method Returns a new Path that is this path with overlapping parts removed.

Path path.trim()

Example of the Path.trim() method

Notes

This method is typically used when Path.offset() caused some overlap. However, use this sparsely or performance will suffer.

This method is recursive and complex, and the performance penalty for using it on a long/complex path will be significant.

To limit the impact of path.trim(), follow this approach:

  • construct a minimal path that contains the overlap
  • trim it
  • now join it to the rest of your path