MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/splashsurf / vertex_keep_table

Function vertex_keep_table

splashsurf_lib/src/mesh.rs:375–390  ·  view source on GitHub ↗

Returns the list of vertices that should remain in the given mesh after keeping only the given cells

(mesh: &MeshT, cell_indices: &[usize])

Source from the content-addressed store, hash-verified

373
374/// Returns the list of vertices that should remain in the given mesh after keeping only the given cells
375fn vertex_keep_table<R: Real, MeshT: Mesh3d<R>>(mesh: &MeshT, cell_indices: &[usize]) -> Vec<bool> {
376 let vertices = mesh.vertices();
377 let cells = mesh.cells();
378
379 // Each entry is true if this vertex should be kept, false otherwise
380
381 {
382 let mut table = vec![false; vertices.len()];
383 for cell in cell_indices.iter().copied().map(|c_i| &cells[c_i]) {
384 for &vertex_index in cell.vertices() {
385 table[vertex_index] = true;
386 }
387 }
388 table
389 }
390}
391
392/// Returns a new mesh keeping only the given cells and vertices in the mesh
393fn keep_cells_impl<R: Real, MeshT: Mesh3d<R>>(

Callers 2

keep_cellsMethod · 0.85
keep_cellsMethod · 0.85

Calls 3

cellsMethod · 0.80
verticesMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected