Pair_Contour Node
Attached is a new node: pair_contour.
Paths in Nodebox can have multiple contours. The most common example is an alphabet character. Letters like "a" have one contour to describe the outside and a separate contour to describe the hole on the inside. Letter's like i have two contours (the shaft and the dot) that are separate but are handled and colored together as a single path.
Pair_contour takes two closed paths, contour A and contour B, and combines them into one - with no external code module required. If A is completely inside B then A will appear as a hole inside B, or vice versa if B is completely inside A. If A and B are separate they will stay that way but be represented as a single path. If A overlaps B, the shared portion will appear as a hole. The combined path will retain the coloring of the first contour even if the second has different coloring.
The Cartan Node Library already has a join_contours node that can join any number of contours (like the letters of a word or phrase) into a single path. But it requires an external Python module, which is a bit of a nuisance. Pair_contour does not require an external module. It can only handle two contours, but in many situations that's all you need. For a letter with two holes, like B, you can use it twice.
The attached demo shows three ways to combine the two contours of a lower case 'a' into a single path. A second subnet on the upper right shows how to recombine the three contours of a capital B.
A subnet on the lower right shows a comparison of pair_contour and join_contours. Both combine two differently colored circles to form a single torus. But join_contours requires that you add contours.py to your code library. It also requires a combine node to form the two contours into a list and a rev_dir node from the Cartan Node Library to reverse the direction of the second circle. In order to form a hole, the two contours have to be ordered in opposing directions (one clockwise, the other counter-clockwise). Pair_contour is an easier way to make a donut.
Enjoy!
- pair_contour_screenshot.png 521 KB
- pair_contour_node.zip 11.8 KB
Keyboard shortcuts
Generic
? | 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