Quads and Quad List

< Previous | Contents | Manuals Home | Boris FX | Next >

Quads and Quad List

The Mesh.Quads() call returns a Quad List, which contains a mixture of triangles and quads (4 sided polygons, not necessarily flat) that has been reconstructed on the fly from the triangle data. The quad list can then be scanned and the triangles and quads exported to downstream software. While changing a Mesh Face changes the mesh itself, the quad list and quads are unchangable— while a mesh face refers to that face number in the mesh, the quad contains the vertex data directly; it is pure data. Quads cannot be selected; the "Vertex and Face Lists" calls above are not applicable to quads.

Quads contain the same attributes as Mesh Faces, ie vertex numbers vA, vB, and vC, adding one new attribute:

.vD index to the 4th vertex, vertex D, of the quad, if any.

Vertex .vD should be checked to determine whether a quad list element is a triangle or quad. If .vD is greater than zero (vertex numbers start at 1), then it is valid and the element is a quad, and .showXY are unused. If .vD is zero, then it is a triangle, and .showXY should be used if possible to control edge visibility.

Here's some sample code:

qlist = msh.Quads() for (qel in qlist)

if (qel.vD > 0)

// we've got a quad, qel.vA, qel.vB, qel.vC, qel.vD else

// we've got a triangle, qel.vA, qel.vB, qel.vC end

end

You can also iterate over the quads using #qlist and qlist[1], qlist[2], etc. of course.

©2024 Boris FX, Inc. — UNOFFICIAL — Converted from original PDF.