Intersecting lines from coordinates and fixed lines
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Emmanouil Barmpounakis
le 27 Avr 2015
Commenté : Emmanouil Barmpounakis
le 27 Avr 2015
How can I find the intersecting points between the line that is created from a set of coordinates and a fixed line? I am trying to use the Curve Intersections function.
Specifically, I have a set of coordinates with x: (NAN NAN NAN x1 x2 x3 x4 x5... xN-1 xN NAN NAN NAN) and y:(NAN NAN NAN y1 y2 y3 y4 y5...yN-1 yN NAN NAN NAN). I want to find whether the line created from these connected corrdinates is intersecting a line with specific start and end point.
x1=val(:,2);
y1=val(:,3);
x2=[-226.586 , -238.954];
y2=[112.566 , 49.459];
plot(x1,y1,x2,y2)
P = InterX([x1;y1],[x2;y2]);
plot(x1,y1,x2,y2,P(1,:),P(2,:),'ro'
And the result I get is:
Error using .*
Matrix dimensions must agree.
Error in InterX (line 60)
S1 = dx1.*y1(1:end-1) - dy1.*x1(1:end-1);
while the plot work just fine! Then, I want to a counter to increase by one IF there is an intersection point between these two lines.
0 commentaires
Réponse acceptée
Andrei Bobrov
le 27 Avr 2015
x1=val(:,2);
y1=val(:,3);
x2=[-226.586 , -238.954];
y2=[112.566 , 49.459];
plot(x1,y1,x2,y2)
P = InterX([x1.';y1.'],[x2;y2]);
plot(x1,y1,x2,y2,P(1,:),P(2,:),'ro')
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur NaNs dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!