[Math] Algorithm to find rectangle inside a triangle

algorithmsgeometrytriangles

I am trying to write a program that generate procedural cities.
However, I am stuck on a problem : I don't know how to subdivide a triangle into a rectangle and other triangles. I know how to subdivide into a quadrangle + triangles but I have to work with rectangles for now.

So I'm searching an algorithm that will, for any kind of triangle, find the biggest rectangle contained inside a triangle.

What I know :

  • the position of the vertices of my triangle.
  • not a lot of math. I would love to change that but I'm not brave enough !

Thanks.

Bump Edit : Can somebody gives me some pointers please ? It would help me a lot. Thanks.

Best Answer

From this article :

Tthe maximum rectangle area occurs when the midpoints of two of the sides of the triangle were joined to make a side of the rectangle and its area is thus 50% or half of the area of the triangle or 1/4 of the base times height.