- 积分
- 2003
- 明经币
- 个
- 注册时间
- 2003-4-30
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2004-1-14 16:16:00
|
显示全部楼层
我怀疑是这里出问题:
- '确定第一个三角形
- '确定第一个顶点(最左)
- Dim sum_x_y As Double
-
- sum_x_y = X(1) + Y(1)
- v(1, 1) = 1
- For i = 2 To arrary_nub
- If (X(i) + Y(i)) < sum_x_y Then
- sum_x_y = X(i) + Y(i)
- v(1, 1) = i
- End If
- Next i
-
- '确定第二隔顶点(距离第一个顶点最近的点)
-
- v(1, 2) = search_min_dis(v(1, 1))'找出最近点
-
- '确定第三隔顶点(这两顶点连线中点最近而且不和这两点在一直线上的点)
- Dim tx As Double
- Dim Ty As Double
- Dim Tz As Double
- tx = (X(v(1, 1)) + X(v(1, 2))) / 2
- Ty = (Y(v(1, 1)) + Y(v(1, 2))) / 2
- Tz = (Z(v(1, 1)) + Z(v(1, 2))) / 2
- v(1, 3) = search_min_dis1(tx, Ty, Tz, v(1, 1), v(1, 2))’找出最近点,而且不在同一直线上
-
- '三角形的扩展
- K = 1
- L = 1
- Dim index_v3 As Integer '记录扩展三角形的第三个顶点
- Do
- '扩展第1边n1-n2
- ProgressBar1.Value = ProgressBar1.Value + 1
- index_v3 = Search_Arc_Max(v(K, 1), v(K, 2), v(K, 3))
-
- If index_v3 <> 0 Then
- L = L + 1
- v(L, 1) = v(K, 1)
- v(L, 2) = v(K, 2)
- v(L, 3) = index_v3
-
- If Is_twice_used(L) Then’'判断该三角形3边是否被前面三角形用过2次
- L = L - 1
- End If
- End If
- '扩展第2边n2-n3
- index_v3 = Search_Arc_Max(v(K, 2), v(K, 3), v(K, 1))‘'找出与v(K, 2), v(K, 3)夹角 最大的点(跟v(K, 1)在不同区)
-
- If index_v3 <> 0 Then
- L = L + 1
- v(L, 1) = v(K, 2)
- v(L, 2) = v(K, 3)
- v(L, 3) = index_v3
- If Is_twice_used(L) Then
- L = L - 1
- End If
- End If
- '扩展第3边n1-n3
- index_v3 = Search_Arc_Max(v(K, 1), v(K, 3), v(K, 2))
-
- If index_v3 <> 0 Then
- L = L + 1
- v(L, 1) = v(K, 1)
- v(L, 2) = v(K, 3)
- v(L, 3) = index_v3
- If Is_twice_used(L) Then
- L = L - 1
- End If
- End If
-
-
- K = K + 1
- Loop Until K = L
|
|