Vertex and face data structures in Wings3d

I could not find this information clearly stated anywhere else, so for the record, I will describe the Wings3d vertex and face data structures here. I did find some useful information about datastructures in this post on How To Write Wings3D Plugins (for beginners), but it was not complete. Note, I am NOT describing the winged edge data structure. That is something else which Wings3d uses internally to represent geometry data.

  • vertex: a triple of real numbers, {X, Y, Z}. When building a shape in a plugin, the vertices of the shape are enumerated in a list. Note, integers are not acceptable. Coordinates must be expressed as floating point numbers, e.g. 0.0 instead of 0.
  • face: a list of indexes of vertices in a vertex list. Vertexes must be enumerated ANTICLOCKWISE when viewed from OUTSIDE the constructed shape

A good concrete example is given by the code for constructing a cube:

Faces = [[0,3,2,1],[2,3,7,6],[0,4,7,3],[1,2,6,5],[4,5,6,7],[0,1,5,4]],
Vertices = [{-Xi,-Yi,Zi},{-Xi,Yi,Zi},{Xi,Yi,Zi},{Xi,-Yi,Zi},

The first face, [0,3,2,1] is the front one in the following drawing:

wings3d face orientation
Front face of cube

Note the directions of the axes – if +Y is up and +X is right, then +Z is towards the viewer. If you get the direction of the Z axis wrong in your code, then all the normals will be flipped.

Leave a Reply

Your email address will not be published. Required fields are marked *