Rectangles in a circle
The function that is presented here can locate the center points of all the rectangles that completely fit inside a circle. It can be used in industries where, for instance, they need to automate a process of taking photos from microchips mounted on a wafer. This function provides the coordinate locations for the desired microchips which can be sent to a linear stage as points of interest.
The inputs of the function are:
• Diameter of the circle (diameter)
• Width of the rectangle (chip_width)
• Height of the rectangle (chip_height)
• Offset in X direction (chip_cntr_x_offset)
• Offset in Y direction (chip_cntr_y_offset)
The values for the offsets are usually zero if the dimensions of the rectangle are even number. In the case of odd values for rectangle dimensions, experience suggests that these offset values are half the width and height accordingly.
The output of the function is a matrix with certain number of rows (corresponding to the number of rectangles that fit inside the circle) and three columns. The first column is a sequential number whereas the second and third columns are X and Y coordinate of the points, respectively.
Cite As
Mahdi Farahikia (2025). Rectangles in a circle (https://se.mathworks.com/matlabcentral/fileexchange/61047-rectangles-in-a-circle), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Graphics > 2-D and 3-D Plots >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0.0 |
