I have a set of co-planar, connected triangles, i.e., a 2D mesh. Now I need to extrude it out a few units in the z-axis. The mesh is defined by a set of vertices which the renderer makes sense of by matching up against an array of triangles.
Example Mesh:
Vertices: (0,0,0), (10,0,0), (10,10,0), (0,10,0) <-- (x,y,z) Triangles: (1, 2, 3) & (3, 4, 1) <-- numbers here reference the position of a vertex above.
So here we have a 2D square. Now I need to add more vertices and triangles to that list to make an extruded shape. Triangles must be in clockwise direction, otherwise they're backface-culled.
Is there a simple algorithm for this? Thank you.
To extrude a mesh face, on the Mesh ribbon, in the Mesh Edit panel, click the Extrude Face tool. The program prompts you to select the objects to extrude and the Face subobject selection filter is automatically activated. Right-click and choose Setting.
When a selection of vertices forms an edge or face, it will extrude as if the edge was selected. Likewise for edges that form a face. To force a vertex or edge selection to extrude as a vertex or edge, respectively, use Alt-E to access the Extrude Edges Only and Vertices Only.
Abstract. Mesh extrusion or exposure is a known complication of procedures using synthetic mesh for vaginal vault and pelvic organ suspension.
Assuming you want to extrude by a distance z, you need to follow these steps:
0) let n be the original number of vertices (4 in your example)
1) For each vertex in your vertex array, add (0,0,z) to it, and add the result to your vertex array, for a total of 2*n vertices. So, for your example, you will add the vertices (0,0,z), (10,0,z), (10,10,z), (0,10,z) to your vertex array, for a total of 2*4=8 vertices.
2) Create a list of boundary (as opposed to internal) edges for your original mesh. To do this, create a list of all triangle edges (3 edges going in clockwise order for each triangle). Then remove pairs of equal but opposite edges (these are the internal edges). For your example, you will start with 6 edges, and end up with 4 edges after removing the edge pair (3,1) and (1,3).
3) for each triangle (a,b,c) in your triangle list, create a corresponding triangle (a+n,b+n,c+n). These will be the extruded faces
4) Finally, you want to create the sides of your extruded shape. For each edge (a,b) in the boundary edge list you created in step 2, add the triangles (a,b,b+n) and (b+n,a+n,a)
That's it. Assuming no typos on my part, and no typos on your part, you should now have your desired mesh.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With