Reputation: 167
This is array of vertex positions taken from this three.js documenation:
var vertexPositions = [
[-1.0, -1.0, 1.0],
[ 1.0, -1.0, 1.0],
[ 1.0, 1.0, 1.0],
[ 1.0, 1.0, 1.0],
[-1.0, 1.0, 1.0],
[-1.0, -1.0, 1.0]
];
If I change elements (vertices) order in this array than resulting shape is changing. I would like to know why this elements are in that specific order because I want to create shapes programmatically. To do this I just have to know why order of vertices do matter. I have tried to figure this out myself but without success.
Upvotes: 1
Views: 722
Reputation: 15941
They're the verts defining two triangles necessary to construct a square.
Image taken via quick google search. Although the diagonal runs the other direction in this case, from [-1,-1, 1] to [ 1, 1, 1].
The Z component of the 3D verts just indicating where on the Z axis the square exists. Depending on the nature of the application, changing that value may not do anything visible.
Upvotes: 2