我试图从一组坐标中绘制动物的轨迹作为线段。我想看看在圆形区域内与外部绘制了多少坐标。我认为与圆相交的坐标被计为内部和外部,但我希望它们被严格计为内部。这是我到目前为止所拥有的:
[in,out] = intersect(circle_poly,trajectory);
plot(circle_poly)
hold on
plot(in(:,1),in(:,2),'b',out(:,1),out(:,2),'r')
legend('Polygon','Inside','Outside','Location','NorthWest')
num_frames_in = numel([in]) %count num elements/frames in polygon
num_frames_out = numel([out]) %count num element/frames outside polygon
total_frames = num_frames_in + num_frames_out
任何帮助将不胜感激,因为我是 Matlab 的新手!