From 63a5c3a16be8eb30e1731a85eb711aa51d9aa43d Mon Sep 17 00:00:00 2001 From: David Jourdan Date: Tue, 22 Apr 2025 14:12:18 -0700 Subject: [PATCH] Add edge permutation to example code In the example code for ```surface_mesh/scalar_quantities``` we need to set the edge permutation before displaying any edge-based quantity, otherwise Polyscope will return the following error: ``` [EXCEPTION] SurfaceMesh rand vals3 attempted to set edge-valued data, but this requires an edge ordering. Call setEdgePermutation(). ``` --- py/source/structures/surface_mesh/scalar_quantities.md | 1 + 1 file changed, 1 insertion(+) diff --git a/py/source/structures/surface_mesh/scalar_quantities.md b/py/source/structures/surface_mesh/scalar_quantities.md index 029813fe..46e522d6 100644 --- a/py/source/structures/surface_mesh/scalar_quantities.md +++ b/py/source/structures/surface_mesh/scalar_quantities.md @@ -25,6 +25,7 @@ ps_mesh.add_scalar_quantity("rand vals2", vals_face, defined_on='faces') # visualize some random data per-edge (halfedges are also supported) vals_edge = np.random.rand(ps_mesh.n_edges()) +ps_mesh.set_edge_permutation(np.arange(ps_mesh.n_edges())) # set permutations so edge data is meaningful ps_mesh.add_scalar_quantity("rand vals3", vals_edge, defined_on='edges') # as always, we can customize the initial appearance