Distance - store three nearest Vertices to given Vertex .... Getting Crazy :D
Hoi Folks,
Im building a conform script and i struggle a lot how to get the three nearest vertices to a given vertice in one iteration. I coded a little thing to get it for two but Im hardly confused how to do it. Any help would be really nice . Greetings EliderDeli
local oldDistance = 1e9
local oldDistance2 = 1e9
local oldDistance3 = 1e9
indexNearestVertice = undefined
first = 0
second = 0
third = 0
myList = refObj.selectedVerts
for i=1 to myList.count by 1 do
(
distanceO = calculatdistance myList[i].pos SelectedVerticeID.pos
if (distanceO < oldDistance) then
(
second = first
first = myList[i]
oldDistance = distanceO
)
if (distanceO < oldDistance2 && distanceO != oldDistance) then second = myList[i]
)
Comments
.
collect pairs of distance and index and then sort by distance
Wow thank you very much this
Wow thank you very much this was extremly helpfull for me.