find points of intersection circle with line
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I need to find and plot the points of intersection of the circle with each rectangle. Could you please help me?
I drew the circle like this:
pos = [0 0 3 3];
rectangle('Position',pos,'Curvature',[1 1])
0 commentaires
Réponse acceptée
KSSV
le 26 Mai 2020
clc; clear all ;
C = [1.5 1.5] ; % center of cricle
r = 1.5 ; % radius of circle
%
x = 0:1:3 ;
y = 0:1:3 ;
[X,Y] = meshgrid(x,y) ;
%
th = linspace(0,2*pi) ;
xc = C(1)+r*cos(th) ;
yc = C(2)+r*sin(th) ;
L1 = [xc;yc] ;
% GEt intersecdtion points
% along X
[m,n] = size(X) ;
for i = 1:m
L2 = [X(i,:) ; Y(i,:)] ;
P{i} = InterX(L1,L2)
end
for i = 1:n
L2 = [X(:,i) Y(:,i)]' ;
Q{i} = InterX(L1,L2) ;
end
P = cell2mat([P Q]) ;
plot(xc,yc,'b') ;
hold on
plot(X,Y,'r')
plot(X',Y','r')
plot(P(1,:),P(2,:),'*k')
InterX can be downloaded from here: https://in.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections?focused=5165138&tab=function
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Polar Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!