Kangaroo: Avoid mesh folding on itself


(Augustin Ceillier) #1

Hi everyone,

I just started using Kangaroo so my question might be obvious. I have mostly a working definition but I would like to add one more goal to avoid the result “folding on itself” (see picture attached).

I assumed I should use the Hinge goal but I still have some tiny folds.

  • Is hinge the proper tool for it or is there another one?
  • Do I still have a fold because of the relative weight of my goals?
  • How to make sure that I will have no folds but still allow relative movement between my faces?

Thanks for your answers!

Kangaroo fold on itself.gh (85.6 KB)

(Pfotiad0) #2

There’s an IGoal for the “no self fold” task available (but I can’t recall the K2 component name).

(Pfotiad0) #3

Found it :

(Augustin Ceillier) #4

Great!! Thanks a lot for your quick answer! it is going to be useful!

Unfortunately, I still have a fold that Isn´t taken into account by the “no fold through” because the faces are not passing through each other due to my surface curvature: my faces are overlapping without intersecting.

There is probably a problem with my naked edges conditions which leads to this issue (they are forced to get a certain length). I need to either exclude some of the naked edges of my Length condition or override that condition by a “hinge range” component.

Is there a way to define a range of acceptable angle for hinges (ie 90%-110% of the original angle)?

(Pfotiad0) #5

Have in mind that if you run a PS like K2 against a crap/invalid/non manifold etc etc mesh (and/or a collection of “wrong” points etc etc) … chances are that you’ll get a crap result. Same for your goals. PS is kinda martial Arts: finesse and not brute force is the secret.

Have in mind that hinges are defined via classic mesh connectivity … meaning that an invalid mesh (and/or a mesh that yields faulty connectivity data) could yield bananas IGoals.

Other than that the good news are that you can do anything imaginable including a vast variety of checks with regard the mesh (is it valid? and if not why? etc etc) … but … er … in my case I work solely via code: this is either Nirvana (you know how to code) or Hell (you don’t).

In the Image captured above (the “big” C#) everything is controlled and since the K2 runs via a Method (in user defined loops, threshold values blah, blah) it’s easy to mastermind an “auto-tune” loop for better approximating the desired results. Obviously bending using hinges is a fine ballance between hinge related stuff, plastic anchors stuff and spring related stuff. Not using negative bending in some (clothed) edges makes things … worse.

So … here’s the deal: if no good Samaritan could provide a solution with K2 242 components I could post here a 100% C# driven def … but the benefit could be highly questionable if you are not familiar with code matters.

(Pfotiad0) #6

BTW: Imagine a clothed edge in a tri mesh. Has 2 vertices that define the start, end hinge pts. The edge has 2 neighbor faces that yield 2 Lists of face vertices (3) : The 2 non common vertices define the tips t1/2 for the hinge. Leaving aside critical things like what is the positive/negative orientation (so for a given edge with a given direction what is the t1/2 sampling rule? [the C# captured is using a Cross/DotProduct check for that] etc etc) … it’s questionable what the hinge tips may be in a quad mesh.

(Augustin Ceillier) #7

Okay, you have a good point here, I probably have some work to do on cleaning a bit my input mesh.

Regarding the C#, I know some basics but definitely not enough to write a procedure or understand it in a decent amount of time. Should probably spend some spare time on it at some point!

I think this folding problem is not worth spending some time building a labyrinthine system for the application I have for that mesh (It is not the final product of my definition, just a step, where minor folds can be acceptable).

Thanks for taking the time to give me detailed answers!