# Intersect Path Node

I have improved the intersect line node I released a few months ago. Attached is a demo network with a new, more general purpose node, intersect.

Intersect finds the intersection points between a line and a general path (which may consists of multiple line segments and bezier curves). You can confine the intersections to the given line segment, or, by checking "extend lines", extend the line infinitely in both directions.

To do this, intersect uses a custom contour node to break the path into separate contours (if any exist) and then my explode node to break everything up into individual line segments and bezier curves. Explode requires my custom node, make_curve. Make_curve and contours are included in the zipped file.

Inside the intersect node are two more specific nodes: intrsct_line and intrsct_curve. Intrsct_line is an improved version of my earlier node which finds the intersection between two lines. Intrsct_curve finds intersection(s) between a line and a cubic bezier curve. The latter node uses an algorithm I found at https://www.particleincell.com/2013/cubic-line-intersection/. Neither of these two nodes requires any custom nodes. For simpler cases you may want to just use one of these two nodes instead of the general purpose intersect node.

The attached demo node shows some example: the intersection of two lines using intrsct_line, the intersection of a line and quad curve or cubic bezier curve using intrsct_curve, and three examples using the general purpose intersect node: a line and a text path, a line and an arc, and a line and a scrolling torture test of different shapes (see attached movie).

It's easy for a child to see where a line and a shape intersect. With this node it is now just as easy for Nodebox to see. Many things that were not possible before are now possible.

Please let me know if you find any examples where this node fails. (The math is complex and rounding errors can sometimes cause problems; I've tested it extensively but might have missed a few corner cases.)

Enjoy and please share your work if you use this node!

John

- intersect_screenshot.png 297 KB
- falling_targets.mp4 237 KB
- intersect.zip 43.5 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