# Force smoothness

Hello,

I’m working on a design that involves a lot of patterns inside letters. In order to get similar patterns but slightly different in each letter I wrote a script to randomly move points but now all smooth points are no longer smooth because, even though they are green, the off curve points are no longer a tangent.

Is there a way (script or already created tool) to make all these curves smooth again?

Thanks.

I’d like to know if there’s a way to do that as well, but my guess is it’s not as easy as it seems because there are multiple solutions to the problem: if a curve node and its two offcurves get misaligned, which one(s) do you move?

You could check for the angle between the three points (probably with a tolerance threshold in the case of short handles on a coarse grid) to find misaligned handles, but then you have to define rules to determine which points have to move to get back on line. Unless your goal is to get your offcurves on either a vertical or horizontal line, that’s very design-specific.

Maybe comparing the outlines before and after your script might help to find out solutions? (ex: if two points match between the before/after outlines, you can rather safely assume its the third one that needs to move)

There are several options.
Just ignore the smooth setting. Nobody will see it at that scale. And aligning the handles will disturb the shape quite a bit.
For a lot of the curves, it might be easier to convert them into line segments. Again, at output scale, it will probably don’t make a difference.

To compute the smoothness: First check if one handle is much longer than the other. Then just adjust the short handle. Then check if one of the handles is horizontal or vertical. You might like to keep that and adjust the other.

Then compute the direction of the line through both off curve nodes. Use that as the direction for both handles. This is very easy to compute and gives a good balance between the two handles as longer handles will have move influence.

If you want to go the convert-to-lines way, there are some interesting scripts in @danielgamage’s repo, especially the one called Subdivide Lines to Curves (Catmull-Clark)

Otherwise, you can take a look at the Green Blue Manager in the mekkablue scripts. But of course, it will not guess your design intention.