I am attempting to align a gaussian stack of 3-8 polygons in a vertical stack, touching at points of intersection. This intersection could either be as Case A, the lowest vertex of polygon n and the highest edge of polygon n+1, or Case B, the lowest edge of polygon n and the highest vertex of n-1 according to the geometry. I am increasingly stumped as to how to do this. I have attempted multiple methods. I have found x intersections between the geometries and then attempted to align the y value according to where the intersection happens. Unfortunately I have been unable to ascertain how to be clear whether it is Case A or Case B. I have attempted to compare angles between the higher and lower edges but as the geometries are rotated sometimes a plain comparison doesn’t work. Any clues as to how to do this would be gratefully appreciated.
What I am attempting to achieve is on the right, what I am getting is on the left:
[edit] but I think I’m missing something… the above is a vertex-vertex placement, you want a vertex-edge placement? like poly can only move along Y for instance, Tetris-like?
Thanks all. Joseph, is there a way of aligning non symmetrical polygons in a vertical stack. My intention is to imitate irregular plant cells of 4-8 sides and for the line lengths to all be random
ok, there’s one important thing to mention tho: this works with the assumption stuff has to always move up (direction +Y) in order to stack (which is the situation you presented)
the two main cases, as you have already recognized in your first post, given two random polygons A and B:
do we weally care to identify which particular case we are on? I don’t think so because at the end we have to use just the vector that makes the geometry travel the most (which is the longest vector)
why that?
because if we pick “not the longest vector”, it means that there would be another available but non-picked solution which would prevent an intersection to happen, and because we are not using it → then that intersection is indeed taking place
so we need to pick the longest calculated vector, which will avoid any other intersection and just leave one vertex intersecting to one edge
after that, just Mass Addition everything and use the Partial Results as Y vectors
I have one final question. Is there a way of assigning an area weighting to each of the ten boxes so rather than a random size, the size is determined by a list. So for example each box has to hit the area of 100cm2 but if I assign a list of say 1.0, 0.8. 1.0. 0.9 etc, each box will be 100cm2, 80cm2, 100cm2 and 90cm2 respectively?
haha, yes I thought of that afterwards… too much of a challenge indeed. I guess then if we just maintain simply rotated geometry but instead set area size per shape that may be better. I could potentially work with @inno 's code to change them by weighting
If I wanted to create a network of these shapes say going right to left what methods do you think would be possible to lock an edge and the propagate out from there?
but ultimately the propagation of the shape is that it shares often 2-3 sides which each other to form a network. Generally the cells maintain one shape, hexagonal in this case like a honeycomb, but in real life these shapes are not perfectly symmetrical, like this: