Kangaroo: make optimized mesh approximate patched surface, given curves

Hi community,

I have a a closed curve, and a mesh.
I want the shape of the mesh to approximate that of the patched surface from the curves
I tried soap film but, the resulting mesh is ‘taut,’ so, the closer to the ‘basin’ of the patched surface, the bigger the deviation, which is wrong for my goals.
Could you please give me some guidance? :pray:
Note: in the following file, the patched surface has 4 sides–in my project, that number can change e.g. 5-sides, 3-sides ect.
solve_for_patch.gh (21.7 KB)

I want to use solver because, I want the resulting mesh to be ‘relaxed’ e.g. regulated by the Smooth goal. Depending on the mesh initialization (such as mine), naively using Brep Closest Points cannot achieve that :slightly_frowning_face:

Besides mesh relaxed-ness, another problem was that the Patch gives a surface that does not follow the given curves in a very obvious way–there are big gaps between the trimmed surface’s edges and the input curves

Thanks for the edit Wim

Are you looking to do something like this?

solve_for_patch.gh (12.7 KB)

1 Like

Thanks so much Daniel! This is exactly what I need! I didn’t realize that trimmed surface can be an input to the On Mesh goal. This will change many of my solver codes!

1 Like

Hi Daniel,

Sorry to bother you again. I put your method through a few other surfaces I need and, I think I’m stuck finding the right ‘hyperparameters’ after searching many combinations.

Two problems emerged from that:

  1. the points won’t stay on surface
  2. the mesh isn’t ‘relaxed’–some vertices like to stay super close to each other. If I force them apart with Smooth, they will stay off the surface itself.

Could you please give me some more guidance? I realize this is a bizarre situation, and I’m trying to find a work-around as well.

Thanks a lot!
wont_stay_on_surface.gh (30.8 KB)

wont_stay_on_surface edited v0 if the distance is problem.gh (24.8 KB)

1 Like

Thanks so much Quan! This looks like exactly what I need!

If you have time, could you please share some insights on [1] what the WarpWeft component is doing (and how that relates to EdgeLengths)? I kind-of get what equal length is doing there–it seems we need different values in either direction based on the ‘dimensions’ of this 4-sided patch.
[2] Following that, if I have many of these patches, does that mean I need to identify which is the ‘long’ side and which is the ‘short’ side?

Many thanks again

In all quad mesh, edges have uv direction, just like untrimmed surface. I don’t know what dictates that order. so, if you feed uv separately into separate EdgeLength, that makes all u same and all v same.

You better show different examples.

1 Like

Thanks a lot! I will try your method on some other four-sides trimmed surfaces I’m working on.