- Home /
Average of Normals
So I have a series of normals, and I want to find the average normal between them. Currently, I'm adding all the vectors together, then normalizing the total. This doesn't seem to be working as accurately as I'd imagined.
Might there be some other method I should try?
Answer by Eric5h5 · Nov 29, 2010 at 10:13 PM
Add them up, then divide by the number of normals.
Huh, weird... I'm basing this on the normals on some terrain my object is in contact with. Even with perfectly smooth, flat terrain, I sometimes get an average that is slightly off-center. This method hasn't made any difference, so I'm guessing it has something to do with the collisions themselves.
Thanks for your input.
Just for the sake of it (this being 7 years old), just wanted to say this works great for me.
private List<Vector3> averageNormalDirections = new List<Vector3>();
private Vector3 averageNormalDirection;
averageNormalDirections.Add(normal);
for (int i = 0; i < averageNormalDirections.Count; i++)
{
averageNormalDirection += averageNormalDirections[i];
}
averageNormalDirection /= averageNormalDirections.Count;
Hey, just wondering: did you ever run into the case that your resulting normal wasn't what you expected? I'm really surprised this is working for you.
For example, take the normals (0,0,1) and (0,0,-1). You add them up, you get (0,0,0).
I know this is an edge case, but it shows that this approach is not theoretically sound.
Your answer
Follow this Question
Related Questions
Angle between Ray and Normal 1 Answer
Vector3.Angle() Never Reaching 0 1 Answer
Angle between vectors - calculation 2 Answers
Vector3.Angle outputs different results for the same values 0 Answers
Get Direction from 2 Vectors - and Apply to Transform 0 Answers