Notifications
Clear all

[Closed] Get Normal of a vert in Edit Ploy

I found Edit Poly made some people trouble , including me. What we did easily in Editable Poly become difficult in Edit Poly.
Here I have a problem to get normal of a vert. Could anyone help to solve?

6 Replies

They only solution I know is to calculate them yourself by averaging the surrounding face normals.
If you work with games you might wanna use the same averaging algorithm as your engine. (e.g. weight normals by face area)

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

… taking into account Smoothing Groups.

Another solution is to query the trimesh value:

getNormal $.mesh index

where $ is your editable poly and index is your vert number.

It’s slow in loops though, I assume because a trimesh is generated for each query. Even assigning $.mesh to a variable and querying that doesn’t seem to speed things up.

In my tests I was surprised to find it’s actually faster to use the averaging of the neighbouring face normals, as mentioned above.

mesh to poly, is very slow compared to, poly to mesh,
$.mesh makes a conversion/copy anyways, it seems, but copying the trimesh in a variable should be fast if its gonna be used many times, ie a loop

396802 verts:

ru= copy $.mesh

ru.numVerts ->> 0ms

polyOp.getNumVerts $ ->> 0ms

ru=$.mesh

ru.numVerts ->> 172ms

$.mesh.numVerts ->> 172ms

Ah yes… I was assigning $.mesh to variable rather than a copy of $.mesh, which is the way to go.

Thanks for everyone for providing solutions. Setting position , setting selection and getting normal in Edit Poly used odd ways to get to be solved. Since there isn’t any default function, I only have to work it out by myself.