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:
- A point p is picked on the segment AB, somewhere between zero and [width] away from A.
- A point q is found on the segment AD, exactly [width] away from p.
- Segment pq is rotated through 90 degrees around both p and q, giving us line segments perpendicular to pq.
- The perpendicular segment starting at p is intersected with BC, giving us p’.
- The perpendicular segment starting at q is intersected with DC, giving us q’.
- 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)
Very nice, David!
@heath, I hope you are following this one
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.
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:
- pick any number of polylines to process (it will automatically determine 4-sided, closed, planar ones only to use)
- define width of the diagonal element
- 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)
- 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!
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)
It’s not quite ready for release yet, but the new constraint solver I’ve been working on handles this sort of thing:
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.
This thread is amazing!
In any other software forum this would have ended with an apologetically “out of scope” response, if any…
Will it be part of V6’s Grasshopper?
heh, I xposted on a sketchup forum… with sketchup, the mindset is often more of 'find the geometric trick" as opposed to use awesome software… if there’s a trick to this, those guys will sniff it out
just posted it an hour or two ago… no solutions yet
As usual, @DavidRutten is a genius! Thanks again. @Jarek , thanks also! As for “what is the practical need for this”, it’s for stiffeners inside this sculpture: http://www.publicsculpture.com/inflorescence.html
And @DanielPiker : Cool!
Nice topic, and nice work Heath!
This function has a bunch of uses beyond heath’s. It would let you know if you could jamb a box or a sofa through a doorway before you picked it up to try physically.
@DavidRutten and @DanielPiker, could your solutions be re-written to provide the user the ability to find a height or width of the outer polygon (assuming 90-degree corners) if the user had a fixed rectangle (the 2x4) that they were trying to fit? In other words, what would be the minimum height (given a set width) or a minimum width (given a set height) for a fixed rectangle?
i just sniffed it out
1-- the shape
2-- criss cross
3-- intersection to perpendicular
6-- bisect green with a line the width of board
7-- move one end to edge
7b- draw line parallel to edge at white’s other end point
8-- move white along red til it intersects
9-- finish off the rectangle
board_ina_quad.3dm (55.9 KB)
probably scriptable, right?
haha. I didn’t really double check that but the board was originally drawn on a parallel to world plane orientation.
so, mirroring the green on the z is going to result in a vertical line when bisecting it.
and the board ends are vertical so…
maybe this is not a trick after all :oops:
can’t check until later though.
ok… had to pull out the laptop on the bus and try…
this is embarrasing… haha.
move along__nothing to see here.
You know, at a first glance before reading your question, this is what I figured was happening.
Your building the ultimate fungi forest in your basement and attic with a whole bunch of sterilite totes, acrylic sheets, and you needed to figure out how big to cut the sheets for your terrariums. Since you didn’t want to buy all the same size storage totes because you being a hippy already had 30 mismatched ones that were on sale. But now I see that the model you have made is much more magical!!!
The old school way, all that is needed is gloves, alcohol, respirator, hair net, a stove, vermiculite and a spray bottle for 3 times daily maintaince! Shitakes that is. The only edible ones that can be pf-tek’ed
Everyone has a little different experiences in life.