How to change the ratio of sectors for a circle with 8 equal sectors
49 views (last 30 days)
Show older comments
I have a circle with 8 equal sectors and radius one(Below is the code I used)
Now, I want to be able to move the circle around whilst keeping the partition lines in place(like in the image below), How can I do this but also be able to calculate the area of each sector for the new circle ?
5 Comments
Matt J
on 10 Oct 2025 at 23:02
Edited: Matt J
on 10 Oct 2025 at 23:40
I want to be able to move the circle around whilst keeping the partition lines in place(like in the image below), How can I do this but also be able to calculate the area of each sector for the new circle ?
Why would the movement of the circle change the area of the sectors?
Do you mean you the center of the radiating pattern is moving while the circumference is not? If so, those aren't really "sectors" anymore, strictly speaking.
Walter Roberson
on 10 Oct 2025 at 23:22
@Matt J The center point that is acting as the intersection, is moving. It is obvious that the areas of the 8 sectors are going to change.
Accepted Answer
Matt J
on 10 Oct 2025 at 23:07
Edited: Matt J
on 11 Oct 2025 at 0:00
One possibility:
dTheta=360/8; %sector angle
t=linspace(0,dTheta)';
sector=polyshape([0,0;cosd(t),sind(t)]);
circle=arrayfun(@(z)rotate(sector,z),(0:7)*dTheta);
newcircle=newCenter(circle, [+0.5,0]);
sectorAreas=area(newcircle)
plot(newcircle); axis equal
function circle=newCenter(circle, t)
R=sqrt(sum(area(circle))/pi); %radius
mag=1+norm(t)/R;
Circle=scale(circle,mag,[0,0]);
circle=intersect( translate(union(circle),t) , Circle);
end
0 Comments
More Answers (1)
DGM
on 11 Oct 2025 at 11:58
Edited: DGM
on 11 Oct 2025 at 12:19
Alternative interpretation, also using polyshape():
This still subdivides the outer circle into equal arc lengths. I'm not really sure if that is intended.
The circle and line intersection positions can be defined independently, so you can choose how you want to configure it.
nsectors = 8; % number of sectors
lineint = [0 0.2]; % position of line intersection
center = [0.5 -0.2]; % position of circle center
radius = 1; % radius of outer circle
np = 100; % points per arc
th = linspace(0,2*pi,nsectors+1); % breakpoint angles
P = repmat(polyshape(),[nsectors 1]);
for k = 1:nsectors
arcth = linspace(th(k),th(k+1),np).';
V = [lineint; [cos(arcth) sin(arcth)] + center];
P(k) = polyshape(V);
end
% i'm using different colors since this is slightly longer than lines()
% this will avoid repeated colors and clearly indicates the sequence order
colororder(parula(nsectors))
plot(P); axis equal; grid on
area(P)
2 Comments
DGM
on 11 Oct 2025 at 21:16
I saw that, but given the manner in which the original code constructed the plot and the crudeness of the drawing, I considered it ambiguous enough that it would be worth throwing down an example anyway. It's my time to waste, after all.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
