Making picture frames with custom profiles and randomly positioned reactangles

Hello forum,

Here is the thing, some area is populated with randomly generated rectangles that are sometimes rotated 90 degrees (this is important, keep that in mind, because it will cause a specific problem later) to fit more shapes that are otherwise won't fit in.

On the example below horizontal rectangle couldn't fit in but its rotated analog could and thus was placed in.

Later, when placed shapes are used to generate frames, because of this rotation, the position of the starting points changes and because of the approach I use to generate the frames some angle values are attached to the wrong corners, this brakes the frame shape and looks like this (on the left the frame of sick shape and on the right the frame of the healthy shape):

Again, this happens because the angle values are assigned to the specific corners (points) and previously rotated shapes get these all messed up:

Easy fix, don't rotate the shapes, problem is, I've already baked a good number of them for later use. I'd like to avoid regeneration because it takes a lot of time and without rotation I constrict the algorithm even more.

Better fix, use a different approach, this is where I'd like to hear suggestions and kicks in a right direction. Please take a look at my definition. It works but I have a feeling like giving an amputee a job of sweeping the floor.

  • up

    peter fotiadis

    You are the very same Tim who recently declared faith to Darkness?

    If so ... get this and enjoy (but did I've got the issue correctly? not sure since your Rhino file was/is unable to fit on Views (why? you tell me), your planes were at Planet Zorg and other mysterious thingies).

    PS: The 4 profiles per frame Tree is present in order to give you some hint(s) for trying other ways to do the very same thing.

    11
  • up

    Joseph Oster

    Well...  It would be nice if you didn't use Kangaroo ('removeDuplicatePts').  I replaced where I guess it was used with the native GH 'CullPt' (Cull Duplicate Points) which appears to allow the code to function:

    I was able to see the mis-placed miter curves causing the twists in some frames and, re-reading your post, was able to see that untwisted frames all had their start/end point at the bottom right corner of the rectangle.  Those that did not were twisted.

    So I thought about reconstructing your rectangles so they would all have the same relative start/end points...  And while looking at that, realized what 'removeDuplicatePts' was doing - the 'Explode V' (Vertices) output gives duplicate points for start/end.

    So instead of that, I used 'Disc' (Discontinuity) which returns four points instead of five for rectangles.  And lo and behold, connecting 'Disc' directly to 'Item' fixed your problem!

    Voila!

    9