Extrudes surface geometry along normals by creating side faces and displaced cap.
Takes mesh (surface-based mesh entity), surface (surface index to extrude), distance (extrusion distance as double, positive outward), smooth (0 = sharp edges, non-zero = smooth normals).
Returns nothing.
3D Graphics
Parameters & Returns
Parameters
meshInt
surfaceInt
distanceInt
smoothInt
Returns
Void
Quick Summary
Extrudes surface geometry along normals by creating side faces and displaced cap.
Takes mesh (surface-based mesh entity), surface (surface index to extrude), distance (extrusion distance as double, positive outward), smooth (0 = sharp edges, non-zero = smooth normals).
Returns nothing.
Technical Exegesis...
Extrudes surface geometry along normals by creating side faces and displaced cap. Takes mesh (surface-based mesh entity), surface (surface index to extrude), distance (extrusion distance as double, positive outward), smooth (0 = sharp edges, non-zero = smooth normals). Returns nothing. Validates mesh exists, type is ENTITY_MESH, surface-based, locked, and surface index valid. Finds boundary edges (edges used by only 1 triangle - perimeter of surface).
Extrudes surface geometry along normals by creating side faces and displaced cap. Takes mesh (surface-based mesh entity), surface (surface index to extrude), distance (extrusion distance as double, positive outward), smooth (0 = sharp edges, non-zero = smooth normals). Returns nothing. Validates mesh exists, type is ENTITY_MESH, surface-based, locked, and surface index valid. Finds boundary edges (edges used by only 1 triangle - perimeter of surface). For each boundary edge, creates quad (2 triangles) connecting original edge to displaced edge. For each interior vertex, creates displaced copy offset by vertex normal x distance. Updates original triangles to use displaced vertices (creates extruded cap). Preserves winding order for correct face orientation. If smooth=1, averages normals for seamless appearance; if smooth=0, keeps sharp crease at extrusion base. Silently returns on errors.
This function creates 3D depth from 2D surfaces via perpendicular displacement. Extrusion fundamental modeling operation: text -> extruded letters, circle -> cylinder, polygon -> prism. Boundary detection: directed edge tracking counts edge usage - edge used once = boundary (open perimeter), edge used twice = interior (shared by adjacent triangles). Side face generation: for each boundary edge (v0->v1), creates quad (v0, v1, v1+displaced, v0+displaced) as two triangles maintaining winding order (outward-facing). Cap displacement: original surface becomes top cap by offsetting vertices along normals. Distance parameter: positive = extrude outward (normal direction), negative = extrude inward (reverse normal), zero = no displacement (generates side faces only for thickness). Use cases: (1) 3D text (extrude font outline), (2) Beveled edges (extrude with small distance), (3) Architectural details (extrude window frames from wall), (4) Game assets (extrude logo decals for depth), (5) Terrain features (extrude cliff edges). Smooth parameter: smooth=0 creates hard edge at base (two separate normals - base and cap), smooth=1 blends normals (gradient from base to cap). Normal-based displacement: each vertex moves along its own normal - curved surfaces extrude smoothly following curvature. Winding order preservation: original triangles wind counter-clockwise (front-facing), side quads wind to maintain CCW from outside. Must lock mesh before calling. After extrusion, unlock to upload. Multiple extrusions possible: extrude, unlock, lock again, extrude further for stepped geometry. Common workflow: Create circle surface, extrude to create cylinder, extrude cap again for button shape. Alternative: model in 3D directly, use CSG operations for boolean modeling, duplicate vertices and scale for similar effect. Boundary edge algorithm: tracks directed edges, normalizes to (min,max) for counting, counts occurrences - 1 occurrence = boundary, 2 = interior, >2 = non-manifold (error condition).