Getting vertex pos using normals, for distance

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

 
Thread Tools Display Modes
  03 March 2018
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!
 
  03 March 2018
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.
__________________
http://www.tysonibele.com
 
  03 March 2018
Originally Posted by ivanisavich: 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.

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!
 
  03 March 2018
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!
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:26 AM.


Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.