Notifications
Clear all

[Closed] Getting vertex pos using normals, for distance

Hiall,
writing my first script (uhm, yeah, well). Tried to use search for info, but failed.

I need to find a distance between vertices and all I got is normal ids. There’re seems to be no methods in #editNormals to acquire vertex id using normal id.
What’s the best way to get vertex id only knowing normal id?

Should I iterate all vertices, get their normals, iterate vertex normals array to see if they are matching?

ps.: i’m feeding normals to different arrays to smooth one of the arrays depending on others. After I find closeset points, I would like to lerp normal between closeset points’ normals, therefore, smoothing needed normals. General recommendations are welcome.

Cheers!

3 Replies

I don’t really understand the question…a mesh’s vertex normal array corresponds 1:1 to the vertex array itself. Ie, ‘getNormal mesh i’ gets the i’th vertex’s normal.

1 Reply
(@ehwasilii)
Joined: 1 year ago

Posts: 0

Hey! Thanks for joining.

Here is what I’m doing. I have a poly mesh with Edit Normals modifier applied. I select different normals by hand and fill arrays with $.modifiers[#editNormals].GetSelection(). So, all I’ve got in a script are normal ids. Now, I need to get vertex id of every normal in every array to measure distance between them.

When I try to access a poly vertex with ID of a normal, naturally, I do get an exception of array out of bounds. That’s because there might be more than one normal under one vertex. Sorry, if I didn’t make myself clear from the start.

I’m not familiar with maxscript, I’ll go look at ‘getNormal’ to see if it gets me anywhere. thanks!

okay, i got it the most monstrous way possible.
I parse all vertices of a mesh, get vertex normals using .ConvertVertexSelection, iterate every normal of every vertex, compare normal ids with the one i’ve selected.
cya!