Notifications
Clear all

[Closed] Get vertex normal from Editable Poly

Erm ok…I suggest you try it and check the resulting vector, then normalize it to see if it’s different. I didn’t mean to make you look bad or anything.

edit: Just to explain. In my example with moving the vertex, if the vector had not been normalized it would not move the vert 10 units but maybe 8.5, 9.3 something like that since the length of the normal would not be 1. That might seem to work when you look at it but it’s not accurate.

(
	local sel = selection[1]
	local vertFaces = polyOp.getFacesUsingVert sel (polyOp.getVertSelection sel as array)[1]
	local tNormal = [0,0,0]; for i in vertFaces do tNormal += polyOp.getFaceNormal sel i
	tNormal / vertFaces.numberSet == normalize (tNormal / vertFaces.numberSet)
)

true
OK

Light

Make a box, select one of the corner vertices and run that code again. If you’re on the same planet as me that should return false.

CML

I have tested it on a plane object and got those results. I think it is valid for the test.

Light

Here is the result of testing with a box:

(
	local sel = selection[1]
	local vertFaces = polyOp.getFacesUsingVert sel (polyOp.getVertSelection sel as array)[1]
	local tNormal = [0,0,0]; for i in vertFaces do tNormal += polyOp.getFaceNormal sel i
	local t01 = tNormal / vertFaces.numberSet
	local t02 = normalize (tNormal / vertFaces.numberSet)
	format "My vector: %, Your vector: %
" t01 t02
)

My vector: [0.333333,-0.333333,0.333333], Your vector: [0.57735,-0.57735,0.57735]
OK

Both vectors’ direction are THE SAME, the only difference is their magnitude. So if you are making any operation using these normals, there shouldn’t be any problem unless it is related to magnitude.

Light

1 Reply
(@rivendale)
Joined: 11 months ago

Posts: 0

Well that is exactly what I was saying! Read my posts again dude, you are too much

The reason it works on a plane is that all the faces of the vert is pointing in the same direction. Anything else than that will return false. Good luck to you.

Btw- were you not from another country a while back?

Guys, don’t tell me I need to close this thread because of some stupid function called normalize? If you can’t agree on the subject, leave it be…

I moved to Canada, but the question here is: what it is to you?

Light

Well Martijn, sorry for the bickering. I’m trying to help the initial poster or anybody else who is interested in getting a vertex normal.

Light- That normal you are getting without normalization is not usable in mathematical functions like dot product,cross product, calculating matrices or any stuff like that. Can’t you see I’m trying to help? I guess your not going to admit you could learn anything from me though since you view me as the competition.

Well Rivendale, judging from your messages it is obvious you don’t intend to teach me something in the first place as can be seen with your previous messages that follow mines by commenting on them.

Maybe you are proofreading my messages, but let me say “No thanks!”

Light

Page 2 / 3