No.11504724 ViewReplyOriginalReport
Hopefully I can explain this well, because I'm having trouble generalizing a result.

I'm trying to divide up an arbitrarily rotated rectangle (given W, L, and theta) into 6 right triangles and a smaller rectangle, all of which are aligned to the x and y axes (see pic related for examples). The reason for this is in a system I'm working with it's very cheap to draw rectangles, and relatively cheap to draw right triangles (both have to be aligned to the x and y axes), but it's very expensive to fill arbitrary shapes that aren't aligned.

I derived some equations in terms of W, L, and theta for the coordinates of a set of vertices that describe all of the points I would need to specify, but my equations fail for certain conditions and I don't understand why.

I expected it to fail when i1[x] < i2[x], this is because you cannot divide a rectangle in the way I'm doing when this occurs, you have to reassign the corner vertices so that the edge c2 <-> c1 is the longer of the two side lengths; another way to put this is instead of drawing the first lines along the x-axis at the two inner corner vertices, draw them along the the y-axis.

I think I may have unwittingly made an assumption in my derivation which causes the equations to fail when in the two conditions shown in pic related, though I'm still unsure what those are. Maybe an assumption about the relative location of a corner vertex?

Here's a link to the MATLAB code I'm using to generate these plots,
drawRotRect.m : https://pastebin.com/RphRbBzW
rotPlot.m : https://pastebin.com/jS2QKeim

I'll post the equations and derivation next, but my handwriting is shit and the diagram I used is too tiny to read so I'll have to draw a new one. I'll probably clean everything up and post the final equations in LaTeX, but it will take me a bit.

Does anyone know why it might fail and what I could do to take into account these other cases or what incorrect assumptions I might have made?