Block orientation

Hi!
I have a geometry set of three blocks. They need to be oriented, unfolded along the contour in this way


It is not quite clear what to use for this and how to orient to the sides of the blocks (which side to anchor the point to and orient to the vector)


They are now “swirling” chaotically around the outline, breaking the boundaries (the blocks must move within the outline in a certain sequence).
Block orientation.gh (25.3 KB)

Get the attached for a start (Bad news: 100% code). Notify if you want a far more elaborated approach for placing the Polylines (like Rotate unti Fit (if possible), auto Scale etc etc).

No modules Ccx check is included.

Polyline_PlaceModulesInFrames_V1.gh (119.0 KB)

Lord, you are in your irresistible style as always!


I’m impressed with your solution and will go learn C## before I’ve even fully mastered Phyton :sweat_smile:
Really, thank you without sarcasm! I really like your unique approach, though “Rhino.Geometry.Curve.Contains(Rhino.Geometry.Point3d” is deprecated

Something set up…Good tetris

Video_2023_01_20_00_27_45_781

Can you please send some kind of morality picture?

1 Like

What about the classic one?

In the mean time … well … the Method used for a valid module pos in the Frame is rather a VERY stupid one:

The pro way is to compare Interval Lengths : for each frame F pts {f0, f1, f2, f3} and for an in place module M Box pts {m0, m1, m2, m3} get:

  1. The Interval MX : (m0.X, m1.X) and the Interval MY (m0.Y, m3.Y).
  2. The Interval FX : (f0.X, f1.X) and the Interval FY (f0.Y, f3.Y).

return
(Interval.FromIntersection(MX, FX).Length != 0 &&
Interval.FromIntersection(MY, FY).Length != 0);

That’s the condition for an inclusion of a module in the frame (at some pos) - for 3D stuff just add things in Z as well.

PS: If you are in the AEC market sector > forget P > go for the real thing. C# is kinda a BMW M3: there’s far better looking cars and far more desirable ones (not to mention reliability) … but that thing is the yardstick since the Dawn of Time.

PS: That said … forget Tetris as well > go for a challenging thing like this:


2 Likes

That said, here’s a small challenge for the brave (but the path is long and hilly).

Set onGrid == 2 and observe that the rnd pts are on a 3d Grid. Now … what I want from you is a simple thing: for any given pt … search in 3 dims (while the next position is occupied, if not stop) and create a 3d like collection of Boxes that should not share any Box with any other collection - like in the animated things above.

Is this solvable via some sort of LINQ (+ a proper Class)? Or via Karma? Or we should rely on Don Julio?

These are the critical questions (for the mankind as a whole).

Boxes_In3dGrid_V1A.gh (118.0 KB)