rectangle attractor

iterates to find the inscribed rectangle inside a convex quadrilateral, if it exists
Updated 4 Jul 2016

View License

No input arguments. Starting at any point [circled in green] on the [black] quadrilateral,
we move in straight [blue] lines inside, horizontally and then vertically,
taking left or right 90-degree turns to reflect off of the convex 4-gon
whenever we impinge on its edge. (Of course, this is different from the
way a light ray reflects from a mirror physically, which is by the law of
equal angles of incidence and reflection.) As we continue this process,
a pattern emerges, either cyclic or chaotic. [Note that the final
nine iterations are highlighted in yellow, and the stopping point is
circled in red.]

Cite As

Lang Withers (2024). rectangle attractor (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Triangulation Representation in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

A better understanding of the conditions for the inscribed rectangle to exist, and other cases, has been included. This version excludes the degenerate case so that only the more interesting cases are run.

initial version v1.0