好象只能用遍历来判断,没有更简单的方法了.
dim colAllPoint as collection
dim P1 as variant
dim P2 as variant
dim minP1 as variant
dim minP2 as variant
dim i as integer
dim j as integer
dim minDis as double
minDis=65500
for i=1 to colAllPoint.count
p1=colAllPoint.item(i)
for j= i+1 to colallpoint.count
p2=colAllPoint.item(j)
if minDis>sqr((p1(0)-p2(0))^2+(p1(1)-p2(1))^2) then
minDis=sqr((p1(0)-p2(0))^2+(p1(1)-p2(1))^2)
minP1=P1
minP2=P2
endif
next j
next i
这个代码是假设你取到了所有的点集
代码是直接写在贴上的没测试,大概就是这个意思,不知道还有没有更简单的方法.能利用ACD内部功能的.全当抛砖了. |