I’m trying hard to reproduce a MATLAB algorithm called “patchnormal” which first calculates the normal vectors of all faces, and after that calculates the vertex normals from the face normals weighted by the angles of the faces. (See illustration below)
There doesn’t seem to be a free library available for 3D mesh in WPF C# oriented to such mathematical use. Or is there ?
So the question is :
How do I compute this (red) vector for all my vertices? Can it be optimized to be used in real time simulation ?

(source: hostingpics.net)
You can compute the angle between two edges as follows:
Then, weight the normals accordingly:
To optimize for real-time, I would first profile to see what was actually slowing things down. I’d guess that computing
atan2()several times per vertex might turn out to be expensive, but improving on that would really require finding some substitute for angle-weighted normals.