Intersect Path Node

john's Avatar

john

24 Mar, 2019 12:07 AM

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

Reply to this discussion

Internal reply

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

Attaching KB article:

»

Already uploaded files

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

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

Recent Discussions

15 Jun, 2019 06:58 PM
26 May, 2019 10:52 PM
02 May, 2019 04:56 PM
27 Apr, 2019 04:03 PM
26 Apr, 2019 12:46 PM

 

26 Apr, 2019 12:17 PM
26 Apr, 2019 12:16 PM
24 Apr, 2019 02:04 AM
31 Mar, 2019 10:32 AM
24 Mar, 2019 08:45 PM
24 Mar, 2019 12:07 AM