Hello,
I tried to find solution here, at the McNeal forums, but failed..
So, the problem is like this. I want to draw some simple geometry like several polygons, and then I want to “cast” their vertices onto some “boundaries” - and these are some rectangles. The original polygons can have dynamic positions, they can be within boundaries of rectangles, but also they can intersect. I try to do this using vectors, with starting points at centres of polygons and ending points at their vertices. For some of them vectors are “positive”, for some “negative”. Here is the idea (original points in yellow, desired points in green, positive vectors in blue, negative ones in red):
So far so good. But when I try to connect “cast” points I would expect the same N-sided polygons as originals, only distorted a bit (blue polygon at the picture below). What I get is not what I expect, due to shifted points orders:
The problem is with the points’ order. I used a method for replacing null items - for projecting points with “positive” vectors some of them are obviously not projected, as they missed the boundaries. So that is why I project these point again, this time using “negative” vectors. Still it’s OK (I know, some of these points are cast wrong way):
I tried the “replacing nulls” method, but there is one issue I cannot solve. Replacing nulls just shifts lists items…:
So, how can I get a proper replacement? What method can I use? Or how to shift lists in a proper way? I would appreciate any help or hints how I can solve this problem.
The GH definition attached.
Cheers, Jaro
proba-01.gh (18.8 KB)