Divide a Path Segment

I have came to halt trying to come up with a good way to create this result.

Question 1) What is the best way to *divide a path segment into equal parts (for example by half, by a third, etc.)
*For Question 1: I have used divide in the sense of adding a node.

Question 2) If you have three nodes and you want to move the one in between to be equidistant to the remaining two. What is a good way to achieve that?

*For question 2: The alignment icons (in palette) are handy, but they move all nodes instead of just the one. So there is no way to lock the extreme ends of the path and just re-position the central one.

I figure there might be script to execute these, and your advice is most welcome.

1: what do you need that for? And what do you consider half? t=.5?
2: there is a Distribute script in my repository.

1 Like

Hey Erich,

(regarding Q1) This is a good example of the functionality. See: divide(length)

(Regarding Q2) - Distribute works nicely, with the caveat that you have to be precise not to select any handles. I am wondering if it would be even more useful if it ignores the selected handles altogether and just affects the nodes (makes for a much quicker selection).

I need this mostly for glyph construction and perfecting the nodes.

Hold down the option key while drag selecting, and it will ignore the handles.

Can you show me an example of a glyph where you need the mathematical third of a segment for constructing? I haven’t seen such a method in type design yet.

Option dragging is part of the basic functionality and I am afraid that I have exhausted the basics some time ago. My question is purely about the ability to center between nodes and to create divisions on a path.

As for your other question an O (or any glyph with a bowl) will be a good candidate if you want to achieve slightly different curves. In these cases adding a node in-between the usual extremes or at 1/3 is useful. For example some O’s are made only with extremes and some are made with additional nodes to control the curvature.

What is easy is to find the t that corresponds to a third, but what you want is the length of the outline, which is more difficult to calculate. But if you can extract the algorithm from these AI scripts, you should be able to turn it into a python script.

As for the O, can you show me an example? I have drawn many Os in my life, but never ever needed the mathematical third of a distance between two extremum points, and I do not understand how this would help in constructing an O. If I see what you want to achieve, maybe I can suggest a better method?

I would prefer not to get down and dirty with scripting myself, but if it comes to that I might have to.

In the meantime what do you think about “Distribute script” ignoring the handles?

There is a free weight(light) with extra nodes on the O. You will notice that if you try to delete one of them the curvature jumps a little.

But lets not be so strict about applying this only to curves. By and large dividing in such a way(Q1) has many other applications as well, especially if you combine it with Scale tool. For example: You draw a segment, divide it in 3-4-5, select the wanted nodes, move them around, scale them up/down until you are satisfied. It is easy way to construct shapes and experiment.

Thanks for giving this a thought. You are right that extracting the algorithm might be viable, but I need to learn how to code first. I suppose that I might ask some programmer friends to take a look. Do they need any special knowledge in a specific language in order to build such a thing for Glyphs? Python maybe.

Python. It is not so difficult, there is a three-step tutorial on this website which gives you all the basics.

I suppose you do not mean ignoring them, but moving them with the adjacent on-curve nodes?

Yes, you are right. I meant moving them along with the nodes.

You can imagine this as making a quick selection(one rectangle) to gather all the nodes and handles in one go and then execute the script, which affect only the central node if 3 are selected.

As for coding, it is an intriguing possibility.

Would be the ideal beginner’s task: check for the types of previous and next nodes, and setting their coordinates accordingly. You should be able to accomplish it after reading these: https://www.glyphsapp.com/tutorials/articles/tag:scripting

Keep this under your pillow: http://docu.glyphsapp.com

Wow. I admit I am tempted, but in case this is really such a small task, I will probably hand it to a programmer who can breeze through it in a jiffy. Learning Python will have to wait for the time being.

Long time ago I was coding my own rough filter, in which I wanted all segments of a path to be divided by equal distance. In the end I couldn’t do it and ended up dividing by equal T, because that was close enough and each node position would be randomised anyway. I wished there was a way to do it as I originally intended. By the way, Adobe Illustrator does it very well.

But for making O a bit different from what you can do with a single segment, I don’t think it’s that useful. It’s about how it looks, not how accurately it’s placed at the half or third (and you will move these nodes anyway). Once you get the right curve, you just have to copy & paste to make the other side.


Hey Tosche,

You are quite right about the O, the placement really doesn’t matter, but consistency surely does and having similarly positioned points (quickly) which you can later tweak will be welcome.

I feel we can achieve better coherence with such a script or even with an enhanced Pen Tool functionality like always highlighting the mid point(red) and snapping in proximity when placing non-extrema points similar to current Shift+Click (pen tool).

In conclusion, AI really does this well, but also C4D with its Chamfer of splines.

What I meant by “Illustrator does it very well” is node distribution of its roughen filter, and possibly not the thing you have in mind.

If you want consistency, you just need copy and paste. Another trick I love especially in letters like o is to use interpolation between background (available in Transformation filter). Paste the path, rotate it by 180 degrees, get the first node consistent, and interpolate by 50%. This way you’re averaging the shape and making it perfectly symmetric.

Fair enough. I figured you meant that the code behind Illustrator provided for such a thing to be implemented with greater ease.

Using the background trick is quite handy and I haven’t used it in such a way. Cheers