Moving a single point of a path

Jussi Jokinen's Avatar

Jussi Jokinen

23 Oct, 2022 10:09 AM


In my recent project I needed to modify one point of a path (move one point of a rectangle). My solution was to create a node for just that – move a point of a given index and then reassemble the path again and re-apply the fill and stroke attributes. See the file attached. The question: was this solution too complex? Is there a cleaner, easier way of doing this seemingly simple operation?

  1. Support Staff 1 Posted by john on 24 Oct, 2022 01:56 AM

    john's Avatar


    Your implementation is fine and I don't think it can be made much simpler. You have to reduce the path to points in order to replace one of those points, and once you reconnect, you have to recolor, and because of the Nodebox bug with strokeColor when strokeWidth is 0, you have to test for that.

    One small improvement. For the third slice node to recover the points after the replaced point, instead of counting the points and doing that math, you can just take the inverse of your first slice node (check the invert box) and drop the first point. That saves you a few nodes.

    For the point I replaced your null node with a point node so that you can set that point directly in movePoint without having to create a separate point node.

    See screenshot and attached zip file.

    For a more general purpose solution, see the push_pull node in my Cartan Node Library. It can handle curved shapes as well as polygons, and instead of replacing a point it creates a force from a given direction that pushes or pulls a subset of the shape's points. You can adjust how many points you wish to affect. It also has a handy "Show Controls" option that lets you see what you are doing.

    Nice work!


  2. 2 Posted by Jussi Jokinen on 24 Oct, 2022 11:32 AM

    Jussi Jokinen's Avatar

    Thanks again John, good points! I have explored your excellent push_pull -node but using it didn't occur to me in this case since I only needed to move one point a few notches down.

Reply to this discussion

Internal reply

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

Attaching KB article:


Already uploaded files

  • Screenshot_2022-10-23_at_13.06.25.png 571 KB
  • 1.59 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

23 Feb, 2024 07:39 PM
23 Feb, 2024 10:02 AM
22 Feb, 2024 05:51 AM
21 Feb, 2024 05:27 PM
21 Feb, 2024 04:49 PM


16 Feb, 2024 05:24 PM
06 Feb, 2024 04:45 AM
19 Jan, 2024 09:50 AM
13 Jan, 2024 03:47 AM
05 Jan, 2024 05:10 PM
05 Jan, 2024 04:54 PM