其他分享
首页 > 其他分享> > 去掉坐标点之间距离近的点

去掉坐标点之间距离近的点

作者:互联网

 

 

tol=0;

adjacent_point_dist=[]; % 这个变量用来存储车道线上相邻点之间的距离
points_veryclose=[];
%2021.12.25 通过定义 adjacent_point_dist这个变量发现,相邻点之间的距离个别是0.2mm,这个不正常,这样相邻的点应该去掉其中一个
for k=2:size(Thefirstline,1)
    tol=tol+sqrt((Thefirstline(k-1,1)-Thefirstline(k,1))^2+(Thefirstline(k-1,2)-Thefirstline(k,2))^2);%路线总长度
    dist_adjacent=sqrt((Thefirstline(k-1,1)-Thefirstline(k,1))^2+(Thefirstline(k-1,2)-Thefirstline(k,2))^2);
    if dist_adjacent<0.05
        points_veryclose=[points_veryclose,k];
    end
    adjacent_point_dist=[adjacent_point_dist,dist_adjacent];
end

Thefirstline(points_veryclose,:)=[];

 

标签:Thefirstline,dist,tol,point,距离,坐标,adjacent,sqrt,去掉
来源: https://www.cnblogs.com/yibeimingyue/p/15922510.html