Basis:
Cross Product
Define two input vectors, Vector1 (x1, y1, z1) and Vector2 (x2, y2, z2), and one output vector, OutVect(ox, oy, oz). The components of OutVect are calculated as follows:
ox = (y1 * z2) - (y2 * z1)
oy = (z1 * x2) - (z2 * x1)
oz = (x1 * y2) - (x2 * y1)
Dot Product
Define two vectors. Vector1 (x1, y1, z1) and Vector2 (x2, y2, z2).
DotProduct = (x1*x2 + y1*y2 + z1*z2)
surface normal:
three vertices V1, V2 and V3, ordered in counterclockwise order, obtain the direction of the normal by computing
(V2 - V1) x (V3 - V1), where x is the cross product of the two vectors
U = (V2 - V1)
V = (V3 - V1)
surfaceNormal.x = U.y * V.z - U.z * V.y
surfaceNormal.y = U.z * V.x - U.x * V.z
surfaceNormal.z = U.x * V.y - U.y * V.x
vertex normal:
Algorithm1:
Use cross-products to calculate the face normals for the triangles surrounding a given vertex, add them together, and normalize.
1. Read the faces in your model file
2. Calculate the face normal
3. Add it to the normal of each vertex making up that face
4. After that's done, normalize all the vertex normals
Algorithm2:
Sum the face normals (component wise) for avery triangle containing the vertex
Devide the summed normal (component wise) by the number of triangles containing the vertex to get the normal for the vertex
Normalize all the vertex normals
reference:
google "Face and Vertex Normal Vectors mdsn"
https://msdn.microsoft.com/en-us/library/windows/desktop/bb324491%28v=vs.85%29.aspx
google "vertex normal wiki"
https://en.wikipedia.org/wiki/Vertex_normal
google "A Comparison of Algorithms for Vertex Normal Computation"
A Comparison of Algorithms for Vertex Normal Computation.pdf
Cross Product
Define two input vectors, Vector1 (x1, y1, z1) and Vector2 (x2, y2, z2), and one output vector, OutVect(ox, oy, oz). The components of OutVect are calculated as follows:
ox = (y1 * z2) - (y2 * z1)
oy = (z1 * x2) - (z2 * x1)
oz = (x1 * y2) - (x2 * y1)
Dot Product
Define two vectors. Vector1 (x1, y1, z1) and Vector2 (x2, y2, z2).
DotProduct = (x1*x2 + y1*y2 + z1*z2)
surface normal:
three vertices V1, V2 and V3, ordered in counterclockwise order, obtain the direction of the normal by computing
(V2 - V1) x (V3 - V1), where x is the cross product of the two vectors
U = (V2 - V1)
V = (V3 - V1)
surfaceNormal.x = U.y * V.z - U.z * V.y
surfaceNormal.y = U.z * V.x - U.x * V.z
surfaceNormal.z = U.x * V.y - U.y * V.x
vertex normal:
Algorithm1:
Use cross-products to calculate the face normals for the triangles surrounding a given vertex, add them together, and normalize.
1. Read the faces in your model file
2. Calculate the face normal
3. Add it to the normal of each vertex making up that face
4. After that's done, normalize all the vertex normals
Algorithm2:
Sum the face normals (component wise) for avery triangle containing the vertex
Devide the summed normal (component wise) by the number of triangles containing the vertex to get the normal for the vertex
Normalize all the vertex normals
reference:
google "Face and Vertex Normal Vectors mdsn"
https://msdn.microsoft.com/en-us/library/windows/desktop/bb324491%28v=vs.85%29.aspx
google "vertex normal wiki"
https://en.wikipedia.org/wiki/Vertex_normal
google "A Comparison of Algorithms for Vertex Normal Computation"
A Comparison of Algorithms for Vertex Normal Computation.pdf
本文介绍了几种基本的矢量运算方法,包括向量叉乘和点乘,并详细阐述了如何通过这些运算来计算面法线和顶点法线,提供了两种不同的顶点法线计算算法。
1918

被折叠的 条评论
为什么被折叠?



