Best way to create a circle with gaps?

Elliot's Avatar


09 Sep, 2018 02:03 AM

Hello all,

I've just begun working with Nodebox, and am having a great time. As a simple project to learn, I am trying to create a circle with gaps in it (see the attached image for reference). I understand how to create a partial or complete circle using a sample, coordinates, and connect node - but I'm unsure on how to open gaps in that circle efficiently, and to have easy control over how many gaps there are. Is this even the best way to approach this?

Any help would be much appreciated! Looking forward to learning more about Nodebox.

  1. Support Staff 1 Posted by john on 09 Sep, 2018 10:18 AM

    john's Avatar

    Hello Elliot,

    There are several different ways of doing this. One simple way is to represent the gaps as a series of pie slices (using the arc node) and subtract them from a circle using a compound node.

    Zipped example code and screenshot attached.

    I begin by building a table of gap starting points (in degrees from 0 to 360) and gap widths (in degrees). You could import these values from a CSV file or generate them within NodeBox.

    For this example I used random numbers. You can adjust the number node at the top to change the number of gaps and fiddle with the random nodes to control the range of gap widths or try different random seeds. You can replace this section with whatever logic you want to create a gap table.

    Once I have the gap starts and widths I feed them into an arc node set to "pie" mode and group them to produce a single shape representing all the gaps (including overlaps and wraparounds).

    I then create a ring by using a compound node to subtract a slightly smaller circle from the main circle. Notice that this compound node is set to Difference with Invert Difference checked. You can adjust the diameter of the outer circle and the thickness of the circle outline. The Diameter node also controls the size of the gap pie slices; I use a slightly bigger circle for them to make sure they extend beyond the main circle.

    Now all we have to do is subtract the gap pies from the ring using another compound node. This one is set to Difference but with Invert Difference unchecked.

    Please let me know if that solves your conundrum and if you have any other questions. Welcome to the NodeBox community!


  2. 2 Posted by Elliot on 10 Sep, 2018 02:05 AM

    Elliot's Avatar

    Thank you! Incredibly helpful and very informative. Very appreciated.

    Thanks again,


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Already uploaded files

  • circle-example.png 10.3 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

10 Dec, 2018 01:47 PM
05 Dec, 2018 09:37 AM
02 Dec, 2018 07:40 AM
29 Nov, 2018 07:38 AM
20 Nov, 2018 11:21 PM