Points and curves

florisdejonge's Avatar

florisdejonge

14 May, 2022 07:46 AM

Hi all,

Recently I asked John this question: What is the best way to edit the handles of points? Meaning the red dots that function as control points. Nodebox numbers them seperately. But how would one change the position of just a selection of soms of these red dots, without adjusting the regular blue points. As far as I know I can't select the red ones, without converting them to blue.

Johns answer contained the following (@John: I hope you don't mind me repeating it here):

If you really start mucking with curves you will need to understand the three point types NodeBox uses: 1 to start a curve, 2 to end it, and 3 for the two control points. Lookup "type" of a point to see what each point is.

You can definitely select and move the red (type 3) points without moving the end points. Take any curve (use my curve node or make a short arc), break it into four points, use first and last to pull out the end points, use slice to pick one or both control points, move the control points using a translation node, recombine the four points with a combine node, then feed that into a connect node with closed unchecked. Voila! A modified curve. The red dots move but remain red.

In a list of points you can also separate out the red ones by using a lookup "type" to find the type, convert to number and compare = 3 with a cull node to pick the just the red ones. You can change their locations, but you have to put them back where you found them. One way of doing that is by building a 3 column table where one column holds an index (0,1,2,...), on holds points, and the third holds the type (1, 2, or 3). You can filter on type=3, muck with locations and rewrite those rows of the table, then append them back, sort by index, lookup all the points, and connect.

In the attached example I've tried the suggestion above, but apparently I'm not doing it correctly (it looks cool though), because the red dots are still converted to blue. Can you help me out?

Also, I find myself returning to the 2.2 library for the fit_curve node. It was omitted once, but what's the best alternative?

Floris

  1. Support Staff 1 Posted by john on 14 May, 2022 12:26 PM

    john's Avatar

    Floris,

    I simplified and fixed your spiral network (screenshot and zipped files attached).

    In the top of your network you make a nice ball by zigzagging points around a circle and smoothing out the path with my old fit_curve node. I simplified the zigzagging part, but it still works just like your original.

    In the bottom half you form a point table, siphon off all the red (type 3) point rows, then attempt to move the first and last of those points before putting everything back together. The mistake you make was using a make_point node to insert the modified points. Make_point always creates type 1 points.

    As it turns out, there is a much easier way to do this. Simply use a translate node. Translate moves a point without changing its type. I made a simple subnetwork to do this and then used it on the first and last red points using the values you supplied.

    If you render the end result and change the offsets for those two points, you can see the red dots moving - which in turn causes the string on either end of your ball to curve a bit. You could use this same principle to change all the red dots.

    Your final result is indeed cool, but is quite different that the ball you started with. This has nothing to do with mucking with those two red dots. It happens because you applied a second fit_curve to the already curved path, producing meta curves. If you wanted to see your modified ball, all you had to do was lookup the points and connect them. In my version I show the modified ball in blue and your meta curve in red.

    As an added bonus, I threw in another node I made recently: set_type. This simply takes a point and changes its type to 1, 2, or 3. You don't need it for what you are currently doing, but it might come in handy in some future projects.

    As for the fit_curve node, I dropped it from my library because I realized there was already a standard NodeBox node that does the same thing: round_segments. Actually, though, it's not quite the same. It transforms a polyline path into a curved spline, but the curves come out slightly different. Most of the time this doesn't matter, but sometimes it does.

    I have also on occasion had to go back and dig out fit_curve, so I guess it was wrong of me to remove it from the library. I will put it back in the next version.

    Hope that clears things up. Please keep the conversation going if you have any more questions.

    John

  2. 2 Posted by florisdejonge on 24 May, 2022 06:27 PM

    florisdejonge's Avatar

    Thanks John. So, to iterate, what I did wrong is that I stacked a fit_curve node onto a fit_curve node, thereby altering the curvature. Another thing I didn't know was that the make_point node would always result in a type 1 point. Thanks for the bonus node as well. As I said, I just got into these points and curves, but it might prove useful. Your help already has been.

    Floris

Reply to this discussion

Internal reply

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

Attaching KB article:

»

Already uploaded files

  • spiral_10052022.zip 27.3 KB
  • Schermafbeelding_2022-05-14_om_09.35.55.png 318 KB
  • Schermafbeelding_2022-05-14_om_09.36.12.png 132 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

16 Jun, 2022 05:30 AM
15 Jun, 2022 06:03 AM
06 Jun, 2022 01:07 PM
02 Jun, 2022 11:58 PM
30 May, 2022 07:48 AM

 

24 May, 2022 06:27 PM
20 May, 2022 04:12 PM
05 May, 2022 02:25 AM
03 May, 2022 04:46 AM
01 May, 2022 09:22 AM
18 Apr, 2022 09:01 PM