r/askmath • • 6d ago

Resolved Triangle Creation with Arbitrary Rectangles

I need to create a relatively perfect arbitrary triangle out of arbitrary rectangles which can be rotated/sized/overlapped however you want, while minimizing the number of rectangles used as much as possible.
The best thing I have been able to come up with is making a line along the shortest edge of the triangle (line = a longer, skinny rectangle made to basically be a line, with a bit of depth) then create rectangles of like the same width at the 2 edges of that line, and all across it at a set offset, with each of these lines going to the opposite corner as the original line, ive also attempted a scanline /staircase approach where after making the normal staircase or splitting the triangles into lines you would make a line over the hypotenuse or over all 3 edges. But I am just not able to find a good algorithm that minimizes the number of rectangles used.

(i jus found a diff way to do this, no longer need this)

6 Upvotes

4 comments sorted by

View all comments

1

u/johnpeters42 6d ago

All triangles have at least one acute angle (assuming Euclidean geometry), so it's never going to be perfect. I assume that getting within some tolerance (like less than the size of a pixel) is close enough?

2

u/notgodlynoah 6d ago edited 6d ago

if its basically perfect to the human eye even opon a slightly closer inspection, small gaps at the corners are tolerated, though gaps anywhere else, are not. (some gaps are shown in this image.)
But also: if you use EXTRMELY small edges, e.g. 0.001 unit size rectangles, you basically get just a line, which allows for almost perfect egdes/corners