circles - rectangle intersection area

A fast function which calculate the intersection area of a circle in a large rectangle.

You are now following this Submission

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 (2026). circles - rectangle intersection area (https://se.mathworks.com/matlabcentral/fileexchange/38463-circles-rectangle-intersection-area), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.3.0.0

clarification:
The function "DistancePoints" used here was downloaded from “geom2d” package created by David Legland.

1.1.0.0

bug fixed

1.0.0.0