Numbering in meshes

 If you every write scripts for Blender, it can be useful to know how Blender numbers the vertices, etc. You can get Blender to show you these numbers by first going to Edit - Preferences - Interface, and in the Display section ticking "Developer Extras". Then go into edit mode, and click Mesh Edit Mode Overlaps; this is top right of the viewport - a square with small squares in each corner, the top right one filled. Tick the Indices option.


You need to be in Edit mode to see them and only selected will be shown. Note that Blender numbers from zero, which is common in coding.

This reveals a rather odd thing about how the faces of cylinders are numbered. 

Vertices are simple. Blender numbers vertices by going round the (supposedly) curved side, starting at positive y. and going clockwise to positive x, alternative bottom, top. So the even vertices are all round the bottom face, and the odd on the upper face.

Edges are a bit more complicated. It starts with the first face, with the three edges round that, then does the next face, and the three remaining edges there (bottom, top, then vertical), and so on round the cylinder. This means the edges round the top are 1, then 3n+2 for n > 0, while the edges round the bottom are 0, then 3n+1 for n > 0, and the verticals are 2, and then 3n for n > -1. This is not as easy as one might hope if you are trying to code a script.

Faces are worse. They start numbering round the curve, but the number of upper face is two less than the number of sides, and the lower face is one more than that. So while edges and vertices number the bottom ones first, with faces it is the upper before the lower, and, worse, it is just out of sequence.

For an eight-sided cylinder, the faces round the "curve" are therefore 0, 1, 2, 3, 4, 5, 7 and 8, skipping 6 because that is the top.

I tried this with cylinders with varying numbers of sides, and it is the same for all I tried - except three. If you cylinder has three sides, the upper face is 2, that is, just one less than the number of sides. 


Comments

Popular posts from this blog

Various tank wagons

Introduction to the Blog

Safety First!