[Closed] Get face index from vertice indexes
Hey guys,
I’m having a hard time getting the face index from a 3 point vertice index. I was hoping there was a simple operation that I could use on an array holding the 3 vertice indexes that would tell me which face they correspond to. I tried using the meshop.GetfacesUsingVert function but that requires a bitarray. Here is a snippet I’m trying to get working.
local faceList = for f in 1 to obj.numfaces collect (getFace obj f + [vOffset,vOffset,vOffset])
for i in faceList do
(
f = meshop.getFacesUsingVert obj i
temp = (meshop.getPolysUsingFace obj f threshhold:360) as array
append polyTris temp
)
Due to some of the changes i need to make to the faceList i can’t assume that the array index is the same as the face index.
A sample value for i is [4,2,1]
what going on in your collect there? what are the offsets and does that really work? Im no expert but that seems a little strange…?
does passing a point3 instead of an array to getFacesUsingVert work?
and isnt the resulting bitarray or array of faces what you want? why not join that to a result array? (but, if you expect just one face per entry it seems you need to append index[1] instead of course…)
The offsets do work because you’re adding a 3 point array from getFace to a 3point array that is the offset. The offsets are there so I don’t have duplicate indexes if I have multiple objects.
Passing a 3point instead of a bit array doesn’t work and thats the problem I was having. This means they I can’t get the resulting bitarray which is what I want.
Thanks DentisT that perfect, thanks guys!
delete objects
obj = converttomesh (geosphere())
vv = for f=1 to obj.numfaces collect getface obj f
for f in #{1,34,46,67..69} collect finditem vv (getface obj f)