Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimizing / simplifying a path

Tags:

algorithm

path

Say I have a path with 150 nodes / verticies. How could I simplify if so that for example a straight line with 3 verticies, would remove the middle one since it does nothing to add to the path. Also how could I avoid destroying sharp corners? And how could I remove tiny variations and have smooth curves remaining.

Thanks

like image 805
jmasterx Avatar asked Jun 13 '10 14:06

jmasterx


People also ask

How do you simplify a path in Illustrator?

Until you get used to adjusting control points to manage curves, you'll appreciate a feature that Illustrator provides to smooth out a jagged path. Choose Object > Path > Simplify to open the Simplify dialog box and clean up selected curves.

Can you simplify a path in Photoshop?

In Photoshop, when you change the selection to a working path, there is a tolerance value that you can change. The higher the number the less points will be created. Obviously the less points the less detail, but it might look terrible.

What is the Simplify Path command used for?

Using the Simplify command - Illustrator Tutorial And what it does is it allows you to reduce the number of anchor points inside your artwork.

How do I clean up a path in Illustrator?

An easy way to clean up your artwork is to choose Object > Path > Clean Up, and select what to clean up (see Figure 10). Another way to clean up your document is to remove unused swatches, brushes, etc.


1 Answers

For every 3 vertices, pick the middle one and calculate its distance to the line segment between the other two. If the distance is less than the tolerance you're willing to accept, remove it.

If the middle vertex is very close to one of the endpoints, you should tighten the tolerance to avoid removing rounded corners for instance.

like image 106
Mark Ransom Avatar answered Oct 14 '22 20:10

Mark Ransom