1
votes

I have a 3d model (from Blender) with vertices, vertices normals (normalized) and faces (triangles). I need to calculate additional vertices and their normals. Other words, I need algorithm to calculate center vertex for triangle from three vertices and three vertices normals.

For example, in picture we have A, B, C vertices. How to calculate D vertex and it's normal?

Or, even better, point E (center of one of the sides).

enter image description here

Could anybody help me?

1
what about this: the center of gravity of a triangle is computed by averaging the coordinates of the triangle corners. Also for computing the normal vector averaging is often good enough. (The normals of the corners should have been normalized to lenght 1 before; the resulting normal vector from averaging must be normalized to length 1 again.)coproc
Thanks for your reply. I added image. Blender gives me normalized vectors, it's ok. Could you share formulas or code?Igor
For the D vertex, just take the average values of each x,y,z coordinate value , D is (avr(x1,x2,x3),avr(y1,y2,y3),avr(z1,z2,z3)), now a vector perpendicular to the D (not to the ABC plane, coz this is a different thing) can be found here opengl-tutorial.org/beginners-tutorials/… under Vertex normalsPlain_Dude_Sleeping_Alone
Thank you, will try to get it. Do you have ready code in C?Igor
@Hey-men-whatsup, I think average values will give wrong coordinate. Average values ignore arc.Igor

1 Answers

1
votes

If you want point D lie exactly on plane based on ABC then I suggest you to use barycentric coordinates. Point D is intersection of medians and it is (1/3, 1/3, 1/3) in barycentric coordinates, or D = 1/3A + 1/3B + 1/3C, E would be (0,1/2,1/2). The normal ND should be calculated in the same way as D, ND = 1/3NA + 1/3NB + 1/3NC.

You didn't state the reason why do you need to calculate D and E. I suppose you want to get more triangles in the mesh, thus better level of detail. In this case PN-triangles should be used