Resampling curves

I am having some problem with a "custom resample" geo node function I am working on. Although I am not sure this is the best place to ask about it, I really need help and I've nowhere else to turn to (or at least that I know of). I am creating a modifier for haircards placement (you can check how a prototype works here: https://www.youtube.com/watch?v=b5M8qGQkV8U) The version on this video, however, works with some workaround that revolves around turning the curve into a mesh, subdividing that and turning it back into a curve, which is all patched up and unreliable. So I am trying to work on an alternative solution, which should be much more reliable: I calculate the angle between points on the curve and redistribute the points according to the result, so the points will be more spaced when it's a closed angle and less spaced otherwise, working similarly to the "evaluated" method of resampling. You can see in the image below what I want: https://i.stack.imgur.com/UeRPn.png I cannot simply use the resample node for a few reasons: 1 - it takes into consideration how many handles there are to make up the final curve, which in turn means that more points on the original curve means a higher point count, which is undesirable, I need my algorithm to just take the form into consideration. 2 - I can't precisely input the number of points I want my final mesh to be divided by, which makes it much harder to optimize properly. 3 - I can't control how much of an effect the resolution adaptability has, meaning I can't input how much the effect spreads the points further apart or closer to each other. I DO have a working function, but it's kind of finicky, it works perfectly... as long as you don't move the control point away from the center of the curve and don't rotate it around, and I have no idea on why that happens. This video shows the problem: https://studio.youtube.com/video/ciNtLmMyMrY/edit Here's the .blend file I posted on stack exchange: https://blend-exchange.com/b/rVE1mvDd/
  • Martin Bergwerf replied

    HI Davi,

    Sounds interesting, but I don't understand your terminology; 'the angle between points on a curve' sounds not uniquely defined (we're talking about a 1 dimensional object (curve) in (in this case) a 3 dimensional space...)

    And what's more: what is a 'closed angle'???

    And what does more spaced mean? Spaced further apart (as it sounds to me)?

    I must admit: I haven't looked at the videos or the .blend file yet, just looked at the .png and I get a feeling for what I think you want to achieve, but it would help if you could  be more precise.

    1 love
  • Davi Souza(uaidavi) replied

    Hello Martin, sorry for taking so long to answer, I wasn't notified of the reply.
    Also the formatting got very messy on the actual post, sorry about that, no idea on why that is.

    Either way, the angle between sections would make more sense, I suppose. I sample a point in the curve and calculate how obtuse/acute the angle at that point is.

    If you take a look at the .blend file or the video it should become much clearer, in fact, I have generated a new .blend that's more organized and easier to understand:
    https://blend-exchange.com/b/Gypa1eXR/

    It should be clean and organized enough, the part of the geo nodes modifier that's dealing with this function is the "DynDiv.002" group.

    What I need, in short: Is a way to resample a curve, that I can adjust its parameters, such as:


    - Minimum and maximum distance according to how accute the angle on my 3D curve is.
    - How much that information affects the curve, making it have a lesser or greater effect on the output
    - A input on how much points the curve will have in total (which is one of the reasons why the default resample node isn't useful to me)

    If you open the .blend file and check it, I have pretty much all of that already working, EXCEPT for the fact that the final result has a bias whenever I move a handle towards either end of the curve or I rotate it around (changing the tangent of the handle) and I have no idea on why that is, as can be seen on this video:
    https://www.youtube.com/watch?v=ciNtLmMyMrY

    The reason I am doing all this is to create a haircard tool which wouldn't require me to work on the topology by hand, makes it easy for me to setup LoDs and is reliable. If you check this other video of mine you can see a worse version of it in action, but it gives some context:
    https://www.youtube.com/watch?v=b5M8qGQkV8U

    For now I don't need help with the other parts of the tool, I have most of it figured out, but this problem with the points moving towards one end or another is something I just couldn't work out. Thanks in advance.