MeshLib
 
Loading...
Searching...
No Matches
MRMapping.h
Go to the documentation of this file.
1#include "MRMeshFwd.h"
2#include "MRVector.h"
3
4namespace MR
5{
6
7// oldData - the data that needs to be compared
8// newToOld - how to compare indexes
9// for greater optimality, it is worth making a resize for newData in advance
10template<typename ValueT, typename IndexT>
12 const Vector<ValueT, Id<IndexT>>& oldData,
13 const Vector<Id<IndexT>, Id<IndexT>>& newToOld,
14 Vector<ValueT, Id<IndexT>>& newData )
15{
16 for ( Id<IndexT> newId( 0 ); newId < newToOld.size(); ++newId )
17 if ( auto oldId = newToOld[newId] )
18 newData.autoResizeSet( newId, oldData[oldId] );
19}
20
21// oldData - the data that needs to be compared
22// newToOld - how to compare indexes
23// for greater optimality, it is worth making a resize for newData in advance
24template<typename ValueT, typename IndexT>
26 const Vector<ValueT, Id<IndexT>>& oldData,
27 const Vector<Id<IndexT>, Id<IndexT>>& newToOld,
28 Vector<ValueT, Id<IndexT>>& newData )
29{
30 for ( Id<IndexT> oldId( 0 ); oldId < newToOld.size(); ++oldId )
31 if ( auto newId = newToOld[oldId] )
32 newData.autoResizeSet( newId, oldData[oldId] );
33}
34
35}
Definition MRMesh/MRId.h:13
std::vector<T>-like container that requires specific indexing type,
Definition MRMesh/MRVector.h:19
Definition MRCameraOrientationPlugin.h:7
void mapNewToOldVector(const Vector< ValueT, Id< IndexT > > &oldData, const Vector< Id< IndexT >, Id< IndexT > > &newToOld, Vector< ValueT, Id< IndexT > > &newData)
Definition MRMapping.h:11
void mapOldToNewVector(const Vector< ValueT, Id< IndexT > > &oldData, const Vector< Id< IndexT >, Id< IndexT > > &newToOld, Vector< ValueT, Id< IndexT > > &newData)
Definition MRMapping.h:25