How to change the ratio of sectors for a circle with 8 equal sectors
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nguyen
el 10 de Oct. de 2025
Comentada: DGM
el 11 de Oct. de 2025
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 comentarios
Matt J
el 10 de Oct. de 2025
Editada: Matt J
el 10 de Oct. de 2025
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
el 10 de Oct. de 2025
@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.
Respuesta aceptada
Matt J
el 10 de Oct. de 2025
Editada: Matt J
el 11 de Oct. de 2025
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 comentarios
Más respuestas (1)
DGM
el 11 de Oct. de 2025
Editada: DGM
el 11 de Oct. de 2025
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 comentarios
DGM
el 11 de Oct. de 2025
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.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

