|
楼主 |
发表于 2011-12-3 22:03:15
|
显示全部楼层
Func getyuan($infos)
Local $fanhui[29][3]
For $i = 1 To 29
$yuange = 0
$xiaxia = ""
$zuobiao = $infos[$i]
If $zuobiao <> "" And StringInStr($zuobiao, ",") Then
For $i2 = 1 To 29
If $i2 = $i Then ContinueLoop
If $infos[$i2] <> "" And StringInStr($infos[$i2], ",") Then
If farxy($zuobiao, $infos[$i2]) <= 5 Then
$yuange = $yuange + 1
$xiaxia = $xiaxia & "/" & $infos[$i2]
EndIf
EndIf
Next
$fanhui[$i][1] = $zuobiao
$fanhui[$i][0] = $yuange
$fanhui[$i][2] = $xiaxia
EndIf
Next
_ArraySort($fanhui, 1, 0, 0, 0)
$del = ""
For $i = 0 To 20
$zuobiao = $fanhui[$i][1]
$zuobiao2 = $fanhui[$i][2]
If $zuobiao <> "" And $fanhui[$i + 1][1] <> "" Then
;MsgBox(0, $zuobiao, $fanhui[$i2][1])
If StringInStr($zuobiao2, $fanhui[$i + 1][1]) Then
$del = $del & "," & $i
_ArrayDelete($fanhui, $i + 1)
$i = $i - 1
If $i < 0 Then
$i = 0
EndIf
EndIf
EndIf
Next
Return $fanhui
EndFunc
Func farxy($xy1, $xy2)
$xxyy1 = StringSplit($xy1, ",")
$xxyy2 = StringSplit($xy2, ",")
$x1 = $xxyy1[1]
$y1 = $xxyy1[2]
$x2 = $xxyy2[1]
$y2 = $xxyy2[2]
Return Abs(Sqrt(($x1 - $x2) * ($x1 - $x2) + ($y1 - $y2) * ($y1 - $y2)))
EndFunc ;==>farxy
目前我只是根据各点为圆心
传入的是一个包含各点坐标的数组
建立2维数组 计算每个点为圆心 5米为半径的圆中包含的各点坐标 以及包含的点个数
将2维数组按点个数排序
处理前者对后者的包含 删除被包含的点 |
|