注意"显示"的精度,与实际的精度,
n次实践(>=100),总结:转换成字符串比较或以距离按精度(如1e-12)筛选. 高效查找表中重复元素及去重复
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=108581&fromuid=202795
(出处: 明经CAD社区)
(defun delsame(l1 rcz / l2);;带容差去重(重复过的取第一次出现),有时处理坐标点需要考虑容差
(while l1
(setq l2(cons(car l1)l2)l1(vl-remove-if'(lambda (x)(equal(car l1)x rcz))(cdr l1))))
(reverse l2))
(defun delsames(l1 rcz / a l l2);;带容差去重(重复过的不出现),有时处理坐标点需要考虑容差
(while(setq a(car l1)l2(vl-remove-if'(lambda (x)(equal a x rcz))(cdr l1)))
(if(=(1+(length l2))(length l1))(setq l(cons a l)))
(setq l1 l2))
(if(=(1+(length l2))(length l1))(setq l(cons a l)))
(reverse l))
页:
1
[2]