Adjust Point Node

john's Avatar

john

12 Sep, 2024 11:54 PM

UPDATE - see subsequent note for an improved version of this node

This is a fun one!

Adjust_point changes the position of one point, or possibly also two adjacent points, in a complex path. By complex I mean anything from a simple line segment to a font character with bezier splines and multiple contours. It changes this point without disrupting the rest of the path, including colorization.

This is particularly useful with those pesky Bézier curves with tricky control points. Adjust_point has a point selector and FIVE different options which you can mix or match to achieve a variety of effects:

  • Point number. If you choose a point number larger than the number of points, it will take the final point.
  • Reposition. The amount to change the X,Y position of the selected point.
  • Repos adj ctrls. If checked, will also reposition any adjacent control points. A type 2 point in the midst of a multi-curve spline will take the control point on either side. An endpoint or control point with only one adjacent control point will take that one point. Points with no adjacent control points will be unaffected.
  • Rotate adj ctrls. If other than zero, adjacent control points will be rotated about the selected point. This twisting motion is highly useful and entertaining.
  • Extend previous. If positive extends, if negative retracts the previous point in relation to the selected point. Applies to all points (not just control points) except for the first point of an open path.
  • Extend next. If positive extends, if negative retracts the next point in relation to the selected point. Applies to all points (not just control points) except for the last point of an open path.

This is one of those nodes that takes some playing with to really understand. The demo includes FOUR examples, each with a screenshot.

Screenshot 1 shows a single point in a simple curve being manipulated one parameter at a time. I first show the original curve, then reposition point 3, then check the box to reposition both of its adjacent control points, then rotate both control points -112 degrees, then extend the previous point 2 by 45 units, then retract the next point by -19 units. The changes are applied in that order, so the extensions move in the direction established by the previous rotation. Fiddle with any of the values in adjust_point6 to see how each parameter affects the overall shape of the curve.

Screenshot 2 shows how to turn an ordinary Verdana Q into a devilish figure by chaining together multiple point changes. The first two adjustments add horns, the next four give it a spiked tail, and the last turns the inner contour into a hideous scream.

Screenshot 3 turns an ordinary pentagon into a diamond using only a single point change. You can use my poly_labels node to see the edge lengths and interior angles as you manipulate the shape.

Screenshot 4 applies the infamous balloon test to simultaneously warp all the balloons, highlights, and strings. Gives it a jaunty look without blowing up.

The changes that adjust_point makes could be made by changing the way you generate your path, but sometimes this is hard to do, so it's easier just to tack on an extra node, or even a chain of extra nodes. Or sometimes you just want to play to see what kind of curves are possible; once you have the parameter values you need to achieve that effect, you can go back and alter the original path directly.

When playing with paths using adjust_point, it is highly recommended to use my new draw_points node. You can adjust the display to see the point numbers clearly regardless of the size or coloring of your path.

There is one catch: adjust_point requires the CONTOURS.PY external code module, so you will have to copy that from my library (or the demo file) and add it to your code library to avoid error messages. I tried to avoid using an external module, but it proved impossible in this case because other approaches, using the compound node, scramble the path order and starting points.

I have only just started playing with this, so still have only a faint idea how it can be used. So I hope someone out there gives this a spin and shares some of the resulting mischief.

Enjoy!

  1. Support Staff 1 Posted by john on 25 Oct, 2024 02:30 AM

    john's Avatar

    UPDATE!

    Adjust_point now ONLY requires contours.py IF the path has multiple contours.

    Adjust_point was originally designed to handle any path, including text paths with multiple contours; that's why the contours.py external module was needed. But often you only want to modify simple paths to create a basic shape. In those cases it is an unnecessary pain to have to add an external module.

    I finally figured out a way to make the node more flexible. Inside it are two different versions of adjust_point: a simple version which assumes a single contour path and the previous full version which can handle multi-contour paths. The improved node now checks to see if the path has more than one contour and then chooses the correct version.

    The attached demo shows the first two cases from above. This demo has a copy of contours.py for your convenience, but that module HAS NOT BEEN ADDED TO THE CODE LIBRARY.

    As a result, if you render the first demo, which shows 6 variations of the same simple curve, it will work fine. But if you try to render the second "Devliish Q" demo (the translate4 node), you will get an error message. To solve this, simply add contours.py to the code library.

    From now on you should use this updated version.

    Enjoy!

  2. 2 Posted by lastvector on 30 Oct, 2024 08:24 AM

    lastvector's Avatar

    This look interesting.
    One thing I definitely miss in Nodebox is the ability
    to move a curve and its handles in the Viewer Pane.

  3. Support Staff 3 Posted by john on 01 Nov, 2024 12:41 AM

    john's Avatar

    Thanks. I am finding this node surprisingly useful. The rotation is especially satisfying.

Reply to this discussion

Internal reply

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

Attaching KB article:

»

Already uploaded files

  • adjust_point_screenshot_1.png 786 KB
  • adjust_point_screenshot_2.png 471 KB
  • adjust_point_screenshot_3.png 504 KB
  • adjust_point_screenshot_4.png 943 KB
  • adjust_point_node.zip 551 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

26 Jan, 2025 02:09 AM
24 Jan, 2025 07:50 AM
22 Jan, 2025 11:42 PM
21 Jan, 2025 09:43 AM
21 Jan, 2025 09:41 AM

 

21 Jan, 2025 09:36 AM
21 Jan, 2025 02:00 AM
16 Jan, 2025 08:30 PM
15 Jan, 2025 06:37 AM
04 Jan, 2025 04:09 AM
03 Jan, 2025 05:32 PM