circles - rectangle intersection area
this function takes a list of circles centered (xcenter, ycenter) with radius r
and calculate the relative area in the rectangle with size xmax/ymax 1024x1024.
rectangle size can be changed
main strength of this function is by its speed of calculation.
average computation time is about 0.3s for 10000 circles.This was achieved by aproximating the circle area into
%3rd order polynoms instead of integrating
%the circle equation for finding the area below the axis.
example
x=1024*rand(1,10000);
y=1024*rand(1,10000);
radius=50;
tic; Result_V=compute_circle_area2(x,y,radius);
toc; %Elapsed time is 0.193961 seconds.
clarification:
The function "DistancePoints" used here was downloaded from “geom2d” package created by David Legland.
Cite As
Doron avramov (2024). circles - rectangle intersection area (https://www.mathworks.com/matlabcentral/fileexchange/38463-circles-rectangle-intersection-area), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
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.