How to calculate the coordinates of the overlaped points over a polygon?

조회 수: 1 (최근 30일)
SUSHMA MB
SUSHMA MB 2015년 4월 22일
편집: DGM 2025년 7월 5일
The example on which i tried to apply the inpolygon is:
solux=[5.95,6.40,6.2,6.3,6.42,6.81,7.26,7.76,6.5,8.1,8.17,8.6,9.06,9.5,8.1]
and soluy = [37.5,37.3,36.8,36.3,35.8,35.5,35.3,35.3,35.1,35.02,34.5,35.07,34.7,34.7,34.02];
and the coodinates of polygon is attached in the attachment. I have used the 'inpolygon(solux,soluy,xv,yv)' to solve the problem, but im unable to draw the coordinates of the polygon into 'xv' and 'xy'. Please find the files for coordinates of the polygon in 'trialdataofcoordinates.mat' file. Please help me out.

답변 (1개)

DGM
DGM 2025년 7월 5일
편집: DGM 2025년 7월 5일
Plot the data and look at it. The data points don't appear to be anywhere near the polygons.
% the data
load trialdataofcoordinates.mat
solux = [5.95,6.40,6.2,6.3,6.42,6.81,7.26,7.76,6.5,8.1,8.17,8.6,9.06,9.5,8.1];
soluy = [37.5,37.3,36.8,36.3,35.8,35.5,35.3,35.3,35.1,35.02,34.5,35.07,34.7,34.7,34.02];
% plot the points
scatter(solux,soluy); hold on
% plot the pgons and calculate intersection
isinpgon = false(numel(mycoordinates),numel(solux));
for k = 1:numel(mycoordinates)
plot(mycoordinates{k}(:,1),mycoordinates{k}(:,2),'k') % assuming these are [x y]
isinpgon(k,:) = inpolygon(solux,soluy, ...
mycoordinates{k}(:,1),mycoordinates{k}(:,2));
end
% clearly, none of the points are in any of the pgons
nnz(isinpgon)
ans = 0

카테고리

Help CenterFile Exchange에서 Geoscience에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by