MeshLib C++ Docs
Loading...
Searching...
No Matches
MRMapping.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMeshFwd.h"
4#include "MRVector.h"
5
6namespace MR
7{
10
11
15template<typename ValueT, typename IndexT>
17 const Vector<ValueT, Id<IndexT>>& oldData,
18 const Vector<Id<IndexT>, Id<IndexT>>& newToOld,
19 Vector<ValueT, Id<IndexT>>& newData )
20{
21 for ( Id<IndexT> newId( 0 ); newId < newToOld.size(); ++newId )
22 if ( auto oldId = newToOld[newId] )
23 newData.autoResizeSet( newId, oldData[oldId] );
24}
25
29template<typename ValueT, typename IndexT>
31 const Vector<ValueT, Id<IndexT>>& oldData,
32 const Vector<Id<IndexT>, Id<IndexT>>& newToOld,
33 Vector<ValueT, Id<IndexT>>& newData )
34{
35 for ( Id<IndexT> oldId( 0 ); oldId < newToOld.size(); ++oldId )
36 if ( auto newId = newToOld[oldId] )
37 newData.autoResizeSet( newId, oldData[oldId] );
38}
39
40}
stores index of some element, it is made as template class to avoid mixing faces, edges and vertices
Definition MRId.h:19
std::vector<T>-like container that requires specific indexing type,
Definition MRVector.h:23
void mapNewToOldVector(const Vector< ValueT, Id< IndexT > > &oldData, const Vector< Id< IndexT >, Id< IndexT > > &newToOld, Vector< ValueT, Id< IndexT > > &newData)
Definition MRMapping.h:16
void mapOldToNewVector(const Vector< ValueT, Id< IndexT > > &oldData, const Vector< Id< IndexT >, Id< IndexT > > &newToOld, Vector< ValueT, Id< IndexT > > &newData)
Definition MRMapping.h:30
only for bindings generation
Definition MRCameraOrientationPlugin.h:8