generative modeling for Rhino
How can you divide a surface (typically generated from lofting two lines) into the minimum number of sub-surfaces such that one vertex of the sub-surfaces is in each of the four quadrants (X,Y : X,-Y : -X,-Y : -Y,X) determined relative to the center point of the sub-surfaces and oriented to the global xy plane?
In the below image Surface 1 fails because it has two vertexes in -X,Y and none in -X,-Y. Surface 2 meets the requirement of having one vertex in each quadrant, but is not the largest surface that could meet the requirment. Thanks!
In your drawing, the divisions between the surfaces are all vertical. Is this always the case? This is not the typical condition for a loft. Also, what exactly is the center? The area center? The average of the corner vertices?
The divisions between the surfaces don’t need to be vertical. In my first attempt at solving this I generated lines in grasshopper (in this case parallel and vertical) that I then used to split the surface. (I was thinking that I could vary the spacing of the splitting lines based on how the surface changes across it’s length, but I’m not having much luck.)
I need the vertices in each quadrant relative to the area center.
Hmm... this is a challenging problem. The area centroid is dependent on the position of the vertices and the vertices are dependent on the area centroid, so the problem is a bit circular to solve. Also, I'm not sure it's always solvable, given a particular pair of curves defining the loft.
I came up with a looping solution using hoopsnake. It's a bit clunky and complex; it's very possible that I overlooked a simpler way to solve the problem. I've clustered the contents of the repeating step for clarity, but the inside is a bit of a mess. Here's a summary of the approach:
1. Take two curved edges
2. from the start points of the two edges, calculate the maximum possible extent of a valid loft on each curve
3. within that range, calculate a series of points along each edge
4. find all possible pairings of points between the two sides (the straight edge of the next division)
5. calculate the lofts between each possible edge pairing
6. test all lofts for the desired condition (one vertex per quadrant)
7. sort successful lofts by area, grab the largest one
8. output the original curves minus the portions now included in the loft
This process is repeated until it is no longer able to find a solution. Sometimes it seems to be able to traverse the entire pair of curves, and other times it fails in the middle.
Hope this explanation is reasonably clear... I'm happy to answer questions if you have any.
What you describe is exactly the logic I was trying to set up. Thank you! It works sometimes on the definition you uploaded, but when I insert new curves it always fails. I am not sure if it is the definition or my inexperience with hoop snake. In the HoopSnake dialogue box when I hit “reset all” then ‘loop all” I get “total solutions: 0.”
Hi Luc -
It seems to me that there may not be a valid solution for every pair of curves. This definition works by assuming that two vertices are fixed (the end points of the curves, or the of the new division line from the previous step) and that two vertices are variable along the length of the remaining curve. It seems to work if the curves are more or less horizontal or more or less vertical. Try rotating your input curves and running the hoopsnake loop again. If it still fails then there may be something wrong with the definition, but I think you'll find that it's dependent on the geometry and orientation of the curves used.