davideberly / GeometricTools

A collection of source code for computing in the fields of mathematics, geometry, graphics, image analysis and physics.
Boost Software License 1.0
1.08k stars 202 forks source link

Largest Fixed-Aspect, Axis-Aligned Rectangle? #87

Closed zickler closed 4 months ago

zickler commented 4 months ago

Is there an implementation of the Largest Fixed-Aspect, Axis-Aligned Rectangle algorithm described in your document https://www.geometrictools.com/Documentation/MaximumAreaAspectRectangle.pdf?

davideberly commented 4 months ago

I implemented it and tested it compared to what Mathematica computes with NMaximize (with constraints). The file is GeometricTools/GTE/Mathematics/InscribedFixedAspectRectInQuad.h

davideberly commented 4 months ago

I will assume that this file works for you. If not, feel free to post again for this issue! (BTW, the same idea applies to fixed-aspect axis-aligned rectangle inscribed in an arbitrary convex polygon.)