DIvide an area into sectors
Afficher commentaires plus anciens
I have a xy-coordinate say (350,339), I wanted to divide the area of size 640x640 centered at the xy-coordinate into 8 sectors (angle of each sector is 45 degree)

Sir the above figure, shows what i want. The blue circle in the center is the xy-coordinate say (350,339).
I also have a set of xy-coordinates attached in the mat-file xyc.mat
I need to find the xy-coordinate closest to the center xy-coordinate in each sector and its distance
Réponse acceptée
Plus de réponses (1)
load xyc
x0=350; y0=339;
[X,Y]=deal(xyc(:,1), xyc(:,2));
theta=180/pi*cart2pol(X-x0,Y-y0);
theta(theta<0)=360+theta(theta<0);
[distancesAngular,imin]=min( abs(theta-linspace(45/2,360-45/2,8)) );
x=X(imin);
y=Y(imin);
scatter(X,Y); hold on
scatter(x,y,80,'filled'); hold off
axis equal
xlabel x, ylabel y
legend('Given Data','Nearest Points')
2 commentaires
Elysi Cochin
le 20 Avr 2022
Matt J
le 20 Avr 2022
@Elysi Cochin It is definitely possible, but you are far from a Matlab novice. You should be able to do it.
Catégories
En savoir plus sur Image Processing Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

