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

 

 

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,:)=[];

 

posted on 2022-02-22 11:59  一杯明月  阅读(201)  评论(0编辑  收藏  举报