Geometry riddle

Hi guys… been forever since I posted here. Crazy busy, but this has me stumped and I feel like some genius here can figure this out, or already has. I have about a hundred variations on this I need to solve fairly accurately. If it was just one, I’d just eyeball it close enough like I did in the example. Any ideas? Will this require a script, or can I lay out some guides somehow to do this? I cannot figure this out. See attached file (also supplied a screen shot). Thanks! Any pointers in the right direction would be useful. rhino_help.3dm (138.0 KB)

Maybe easier to visualize: you have a room that’s all out of whack (no 90* angles) and you want to jam a 2x4 between two opposite corners. You want to measure and cut the 2x4 right the first time, and have it wedge in perfectly. (That’s not what I’m doing, but just for visualization).

Hmmm - so, it looks like the ends are at 90 degrees to the line between the opposite corners of the outer shape. You could, if you had the patience, monkey with History to help but I am not sure it is any better than what you are doing, just maybe more fine- tunable - and, if you get one end right, you know the other end will be right, as far as I can see.

  1. Make the twobyfour too long at one end or move it to one corner
  2. Extrude the twobyfour and the outer shape a short distance.
  3. With History, intersect the two results.
  4. With History, loft between the vertical lines.

rhino_help_PG.3dm (171.0 KB)

In Top, the edge of the loft is the line you are looking for, so to speak - the end of the board.
Slide the twobyfour back and forth along a line perp to the corner-to-corner line and stop when the edge of the loft is at 90 degrees to the corner to corner line… A bunch of parallel reference lines would help. I used Gumball with GumballDragStrength at a low number to fine tune.

-Pascal

what @pascal recommended will work, but it is true that there are an infinite number of solutions for any given room shape and board width when the board is sufficiently small. Do you need to restrict the solutions further to a single case?

I think if the ends are square only one solution exists that fits both ends, right?

-Pascal

yeah… 1 solution.
driving to moms for thanksgiving. can’t draw now :wink:

Thanks guys… as I feared, monkeying around with each one is probably the best solution. Thanks…

Sorry, I misspoke. I believe you’re right that that there is one solution for a given width. There is an infinite family of combinations of position and length. There are also cases where no solutions exist if you’re restricting the input appropriately. I also don’t think its true that the solution necessarily lies along the bisector.

Right, that was not correct.

-Pascal

I messed around with this far too long last night. I came up with several ways of solving it. All involve either finding roots of 4th degree polynomials or minimizing nonlinear functions of more than one variable. The way to solve these kinds of problems is to use an iterative method, which boils down to making a good guess and monkeying around until you get a good enough fit. Maybe I’m missing a clever geometry argument that gives a direct solution, or a way to reduce to a quadratic equation. I’ll look again this weekend. I can probably put a test command with the iterative solution in the next SR if you want.

Chuck

5 Likes

Those problems are too interesting…
reminds me of this brain teaser:

Yes, they are too interesting.
I had thought that it would be simple with Galapagos in Grasshopper but I must be doing something wrong.

rhino_help-wrmd.gh (17.6 KB)
@DavidRutten, any pointers to what is wrong here? It seems like the definition is too rotation-adverse.
(note: this is a mm definition - I have no idea what it does in an inch model)

Hi Wim,

this is really just a 1 variable problem, I’m not sure why you’re changing 4 sliders.

problem.gh (7.5 KB)

Edit: you’re probably trying to solve the original problem no? I was confused.

Yes, the original problem. Sorry, I could have included a 3dm.

But it still is only a one variable problem. The attached file solves the problem in several steps:

  1. A point p is picked on the segment AB, somewhere between zero and [width] away from A.
  2. A point q is found on the segment AD, exactly [width] away from p.
  3. Segment pq is rotated through 90 degrees around both p and q, giving us line segments perpendicular to pq.
  4. The perpendicular segment starting at p is intersected with BC, giving us p’.
  5. The perpendicular segment starting at q is intersected with DC, giving us q’.
  6. The distance between p’ and q’ is optimized to be identical to the desired [width].

In the above narrative, the only choice we have is where along AB to place p, everything else follows unambiguously from that.

Fit.gh (13.1 KB)

1 Like

Very nice, David!
@heath, I hope you are following this one :wink:

Fantastic!

So much to learn from…

The ladder problem was in my mind for years.
I know a real solution, but the GH approach is much more elegant.

-C-H-A-R-L-E-S-

Hi All,

Interesting riddle indeed and I’m curious to see what is the practical need for this coming for @heath.
@DavidRutten 's GH illustrates and solves nicely what I crudely mocked up in a script last night. It is a brute-force iterative solution that with some more time invested could be much faster, if binary search was implemented.
I tested it a bit, but for some curves there is no solution and obviously the width parameter must make sense for the scale of the outer polylines…

Here is how it works:

  1. pick any number of polylines to process (it will automatically determine 4-sided, closed, planar ones only to use)
  2. define width of the diagonal element
  3. define number of steps/iterations (depending on the scale and accuracy needed, you may need to go anywhere between 1000 and 10 000 I guess)
  4. It will output both best fit diagonal shapes color-coded, with a point object in the corner affected by tolerance (all other 3 corner will fit perfectly)

If you have 100’s of shapes to process like that it may take a while, but I guess you can go get a coffee and have a bit better time than placing all of the diagonals by hand!

FindThickDiagonal.rvb (4.2 KB) FindThickDiagonals.3dm (42.8 KB)

1 Like

@heath

I know you’re not into GH, but I put the above logic into a component for realtime solving. It should make it a lot easier to do this on a bunch of polygons. The get the component working you’ll have to install GH (Rhino5), and then replace the Curve.gha file with the one attached to this post. It adds a new component called 2x4Jam.

The solver isn’t particularly good, it only gets an answer if the room shape is reasonably well balanced.

Curve.zip (244.7 KB)

1 Like

It’s not quite ready for release yet, but the new constraint solver I’ve been working on handles this sort of thing:
[https://vimeo.com/113029412][1]
Here we have 3 perpendicularity constraints for the rectangle, 1 length constraint for its width, and 4 collinearity constraints to keep the corners of the rectangle on the outer quadrilateral’s edges.
[1]: https://vimeo.com/113029412

6 Likes