How to change the ratio of sectors for a circle with 8 equal sectors

49 visualizzazioni (ultimi 30 giorni)
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 Commenti
Matt J
Matt J il 10 Ott 2025 alle 23:02
Modificato: Matt J il 10 Ott 2025 alle 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
Walter Roberson il 10 Ott 2025 alle 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.

Accedi per commentare.

Risposta accettata

Matt J
Matt J il 10 Ott 2025 alle 23:07
Modificato: Matt J il 11 Ott 2025 alle 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)
sectorAreas = 1×8
0.8012 0.4625 0.1979 0.1092 0.1092 0.1979 0.4625 0.8012
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
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

Più risposte (1)

DGM
DGM il 11 Ott 2025 alle 11:58
Modificato: DGM il 11 Ott 2025 alle 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)
ans = 8×1
0.5109 0.3245 0.1781 0.1573 0.2745 0.4609 0.6073 0.6281
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
  2 Commenti
Torsten
Torsten il 11 Ott 2025 alle 17:42
Cited from the OP:
Now, I want to be able to move the circle around whilst keeping the partition lines in place(like in the image below),
So I think @Matt J 's interpretation is correct.
DGM
DGM il 11 Ott 2025 alle 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.

Accedi per commentare.

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by