
Matrix indexing in a function
    6 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    arun Dhillon
 am 9 Okt. 2019
  
    
    
    
    
    Beantwortet: Stephan
      
      
 am 10 Okt. 2019
            I have an m*3 matrix(metric). Inside the matrix 'metric', I am having x(1st column),y(2nd column) coordinates and the respective radii(3rd column) of each of those circles; thus each row represent a different circle. I need to find if any of the respective circles are intersecting with each other and if yes then which one is intersecting with which one. My question is how can I compare or calculate each of the circle and compare with each other to see if any of the circles are intersecting and where.
Please guide me with any way to solve this problem.
Any suggestion or help is greatly appreciated.
0 Kommentare
Akzeptierte Antwort
  Stephan
      
      
 am 10 Okt. 2019
        It is a good idea to work with polyshape objects in this case:
% Find intersected circles
P = [0 0 1; 1 1.5 0.75; 2 1 0.5];
for k = 1:size(P,1)
polyout(k) = polybuffer(P(k,1:2),'points',P(k,3));
end
TF = overlaps(polyout)
% Plot  results
plot(P(:,1),P(:,2),'r.','MarkerSize',10)
hold on
plot(polyout)
axis equal
hold off
results in a matrix showing you which circles are intersecting:
TF =
  3×3 logical array
   1   0   0
   0   1   1
   0   1   1
looks:

read more here:
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

