Skip to main content

register_surface_mesh

Function register_surface_mesh 

Source
pub fn register_surface_mesh(
    name: impl Into<String>,
    vertices: Vec<Vec3>,
    faces: impl IntoFaceList,
) -> SurfaceMeshHandle
Expand description

Registers a surface mesh with polyscope.

Accepts any face format implementing IntoFaceList:

  • Vec<UVec3> or Vec<[u32; 3]> for triangle meshes
  • Vec<Vec<u32>> for arbitrary polygon meshes (triangles, quads, n-gons)

Polygonal faces are automatically fan-triangulated for rendering while preserving the original face structure for quantities and wireframe display.

ยงPanics

Panics if any face has fewer than 3 vertices or contains out-of-bounds vertex indices.