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

Method to_vec

splashsurf_lib/src/density_map.rs:270–281  ·  view source on GitHub ↗

Converts the contained map into a vector of tuples of (flat_point_index, density)

(&self)

Source from the content-addressed store, hash-verified

268impl<'a, I: Index, R: Real> DensityMap<'a, I, R> {
269 /// Converts the contained map into a vector of tuples of (flat_point_index, density)
270 pub fn to_vec(&self) -> Vec<(I, R)> {
271 match self {
272 DensityMap::Standard(map) => map.iter().map(|(&i, &r)| (i, r)).collect(),
273 DensityMap::DashMap(map) => map.iter().map(|(&i, &r)| (i, r)).collect(),
274 DensityMap::Dense(values) => values
275 .iter()
276 .copied()
277 .enumerate()
278 .map(|(i, r)| (I::from_usize(i).unwrap(), r))
279 .collect(),
280 }
281 }
282
283 /// Returns the number of density entries
284 pub fn len(&self) -> usize {

Callers 4

keep_cells_implFunction · 0.80
try_from_genericMethod · 0.80

Calls 2

collectMethod · 0.80
iterMethod · 0.45