Function NewFindComrade2 (ArrTri, ArrTriID)
Dim buddies(),triangles(),oops, ArrTrixy, testline,cntr, winline, EQscore
Dim j,k,p,q,i,n,w,y
Dim d,dwin,J1,K1,P1,Q1
Dim d1,d2,d3,U1,V1,u,v,m
Dim buddiesID()
ArrTrixy = ArrTri
’Rhino.EnableRedraw (False)
For i=0 To Ubound (ArrTri)
For w=0 To 2
ArrTrixy(i)(w)= Rhino.PointAdd (ArrTri(i)(w), array(0,0,-1*ArrTri(i)(w)(2)))
Next
ReDim Preserve triangles(i)
triangles(i) = Rhino.AddPolyline (array(ArrTrixy(i)(0), ArrTrixy(i)(1), ArrTrixy(i)(2), ArrTrixy(i)(0)))
cntr = FindCenter (array(ArrTrixy(i)(0), ArrTrixy(i)(1), ArrTrixy(i)(2)))
Rhino.ScaleObject triangles(i),cntr,array(0.95,0.95,1),False
Next
n=0
For j = 0 To Ubound (ArrTrixy)
For k = 0 To 2
If Not IsNull (ArrTrixy(j)(k)) Then
For p=j To Ubound (ArrTrixy)
If p<>j Then
For q=0 To 2
If Not IsNull (ArrTrixy(p)(q)) Then
For u = p To Ubound (ArrTrixy)
If u<>p And u<>j Then
For v=0 To 2
If Not IsNull (ArrTrixy(u)(v)) Then
’cntr= FindCenter (array(ArrTrixy(j)(k), ArrTrixy(p)(q), ArrTrixy(u)(v)))
If Not IsNull (cntr) Then
d1= Rhino.Distance (ArrTrixy(p)(q), ArrTrixy(j)(k))
If d1 < MaxVaultDist2 Then
d2= Rhino.Distance (ArrTrixy(u)(v), ArrTrixy(p)(q))
If d2 < MaxVaultDist2 Then
d3= Rhino.Distance (ArrTrixy(j)(k), ArrTrixy(u)(v))
If d3 < MaxVaultDist2 Then
d=d1+d2+d3
testline = Rhino.AddPolyline (array(ArrTrixy(j)(k), ArrTrixy(p)(q), ArrTrixy(u)(v),ArrTrixy(j)(k)))
oops = 0
For y=0 To Ubound (triangles)
If Rhino.PlanarCurveCollision(testline, triangles(y)) Then
Rhino.Print “Got some Overlap Action”
oops = oops+1
End If
Next
If oops = 0 Then
’EQscore = GetEQScore (array(ArrTrixy(j)(k), ArrTrixy(p)(q), ArrTrixy(u)(v)))
’If EQscore > EQmin Then
n=n+1
If n=1 Then
dwin=d
J1=j
K1=k
P1=p
Q1=q
U1=u
V1=v
winline = Rhino.CopyObject (testline)
Else
If d<dwin Then
dwin=d
J1=j
K1=k
P1=p
Q1=q
U1=u
V1=v
Rhino.DeleteObject winline
winline = Rhino.CopyObject (testline)
End If
’End If
End If
End If
Rhino.DeleteObject testline
End If
End If
End If
End If
End If
Next
End If
Next
End If
Next
End If
Next
If n>0 Then
ReDim Preserve buddies (m)
ReDim Preserve buddiesID (m)
ReDim Preserve triangles(Ubound (triangles)+1)
buddies (m) = array(ArrTri(J1)(K1),ArrTri(P1)(Q1),ArrTri(U1)(V1))
buddiesID(m) = array(ArrTriID(J1)(K1),ArrTriID(P1)(Q1),ArrTriID(U1)(V1))
ArrTrixy(P1)(Q1) = Null
ArrTrixy(J1)(K1) = Null
ArrTrixy(U1)(V1) = Null
m=m+1
n=0
triangles(Ubound (triangles)) = Rhino.CopyObject (winline)
’Rhino.DeleteObject winline
End If
End If
Next
Next
NewFindComrade2 = array(buddies,buddiesID)
Rhino.EnableRedraw (True)
End Function
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.