Today, the teacher asked me to create a surface model of the cylindrical surface. Because we need to add illumination, we need to obtain the normal vector of each vertex, however, because the cylindrical surface can be rotated and transformed, the difference between CP3 (x, y, z) and CP3 (0, Y, 0) cannot be used to obtain the normal vector. Later I thought that because the cylindrical surface has the symmetry before and after, we can use the difference between the two relative vertices to obtain the normal vector of a certain point.
The details are as follows:
The above table is an expanded diagram on the side of a cylindrical surface. Suppose we divide the cylindrical surface into N1 segments along the circumference, N2 as the height direction, and the two components of the V point represent the height direction and the circumference direction respectively, then the coordinates of the two relative points are vs (x, (Y + N1/2) % N1), ve (x, y ). Using these two points, we can obtain the method vector of.