MeshLib
 
Loading...
Searching...
No Matches
MRMapEdge.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRphmap.h"
4#include "MRVector.h"
5#include "MRBuffer.h"
6
7namespace MR
8{
9
11[[nodiscard]] inline EdgeId mapEdge( const WholeEdgeMap & map, EdgeId src )
12{
13 EdgeId res = map[ src.undirected() ];
14 if ( res && src.odd() )
15 res = res.sym();
16 return res;
17}
18
20[[nodiscard]] inline EdgeId mapEdge( const WholeEdgeHashMap & map, EdgeId src )
21{
22 EdgeId res;
23 auto it = map.find( src.undirected() );
24 if ( it != map.end() )
25 {
26 res = it->second;
27 if ( src.odd() )
28 res = res.sym();
29 }
30 return res;
31}
32
34[[nodiscard]] inline UndirectedEdgeId mapEdge( const UndirectedEdgeBMap & map, UndirectedEdgeId src )
35{
36 return getAt( map.b, src );
37}
38
40[[nodiscard]] MRMESH_API UndirectedEdgeBitSet mapEdges( const WholeEdgeMap & map, const UndirectedEdgeBitSet & src );
41
43[[nodiscard]] MRMESH_API UndirectedEdgeBitSet mapEdges( const WholeEdgeHashMap & map, const UndirectedEdgeBitSet & src );
44
46[[nodiscard]] MRMESH_API UndirectedEdgeBitSet mapEdges( const UndirectedEdgeBMap & map, const UndirectedEdgeBitSet & src );
47
48} // namespace MR
int EdgeId
Definition MRDotNet/MRMeshFwd.h:52
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Definition MRCameraOrientationPlugin.h:7
T getAt(const Buffer< T, I > &bmap, I key)
given some buffer map and a key, returns the value associated with the key, or default value if key i...
Definition MRBuffer.h:119
HashMap< UndirectedEdgeId, EdgeId > WholeEdgeHashMap
mapping of whole edges: map[e]->f, map[e.sym()]->f.sym(), where only map[e] for even edges is stored
Definition MRMesh/MRMeshFwd.h:459
MRMESH_API UndirectedEdgeBitSet mapEdges(const WholeEdgeMap &map, const UndirectedEdgeBitSet &src)
given input bit-set (src), converts each id corresponding to set bit using given map,...
EdgeId mapEdge(const WholeEdgeMap &map, EdgeId src)
given input edge (src), converts its id using given map
Definition MRMapEdge.h:11