pub fn move_vertex_to_average<T: CoordsFloat>(
t: &mut Transaction,
map: &CMap2<T>,
vid: VertexIdType,
others: &[VertexIdType],
) -> StmClosureResult<()>
Expand description
Move a vertex to the average of the others’ values.
This function computes the average of a list of coordinates and assigns that value to the specified vertex.
§Arguments
t: &mut Transaction
– Associated transaction.map: &mut CMap2
– Edited map.vid: VertexIdType
– Vertex to move.others: &[VertexIdType]
– List of vertex to compute the average from.
§Errors
This function will abort and raise an error if the transaction cannot be completed.
§Panics
This function may panic if one vertex in the others
list has no associated coordinates.
§Example
For an example of usage, see the shift
benchmark code.