Sub topic 1
Vertices: the points of a mesh
Prerequisites
This chapter assumes you can read 3D coordinates written as (x, y, z) and follow short Python code. You do not need prior modeling experience.
What a vertex is
A vertex is a single point in 3D space. A mesh stores each vertex as a coordinate triple. A cube has eight vertices, one at each corner.
vertices = [
(0, 0, 0), # index 0
(1, 0, 0), # index 1
(1, 1, 0), # index 2
(0, 1, 0), # index 3
]
print(len(vertices)) # 4Each vertex is identified by its index, its position in the list. Other parts of the mesh refer to vertices by index instead of copying coordinates. This keeps the data small and makes it easy to move a point in one place.
Edges: connecting vertices
An edge is a straight segment that joins two vertices. Vertices alone do not form a shape. The mesh also needs to know which pairs connect. For the four points above, the edges are the pairs (0, 1), (1, 2), (2, 3) and (3, 0).
edges = [(0, 1), (1, 2), (2, 3), (3, 0)]Faces: surfaces bounded by edges
A face is a flat polygon bounded by a closed loop of edges. A triangle has three edges, a quad has four, and an n-gon has n. The face is stored as the list of vertex indices around its boundary, so the square above is the face (0, 1, 2, 3).
Exercise
A triangle is built from vertices 0, 1 and 4. Which edges does it have, and how would you store the face?
Show answer
It has three edges: (0, 1), (1, 4) and (4, 0). Store the face as (0, 1, 4).