How do I restrict moving and rotation of curve within given boundary?

I managed to remap domains and achieve the effect so whatever the moving sliders’ value is the rectangle does not cross surface boundary line. However, this solution doesn’t work if the boundary isn’t rectangular.

Can anyone help please?

earthwork_01.gh (327.3 KB)

Search for Kangaroo curve collision

Any chances I can avoid additional solvers? I need to use the inputs as genes for Galapagos

What are you trying to do?

Trying to find the most flat part of the surface under the footprint. I need xy movement over the entire plot and a limited rotation constrained by angle slider’s min/max values (i.e. from-20 to 20 degrees)

I don’t understand yet. The file above does not contain any terrain data.

earthwork_01.gh (596.2 KB)

Should be there now (internalized)

It looks like it would be possible to include that in the Galapagos solving. If you create some value which increases the more the rectangle extends beyond the boundary, you can use it as a penalty and subtract a multiple of it from the fitness value.

I can’t open your script, but I have a couple ideas

point in trimmed boundary.gh (97.1 KB)

  • first example, like @DanielPiker said, use distance from the correct zone ( = 0 if inside, > 0 if outside ) to modify the fitness value
  • second example, create a grid of points inside the region a navigate in it

The second one is interesting as I might solve the entire thing with subdivision. Thank you

a few adjustments… I usually use dimensions divided by a grid size to get a more square-like grid with a single parameter
point in trimmed boundary 2.gh (58.6 KB)