MeshLib C++ Docs
Loading...
Searching...
No Matches
MRPartMapping.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMapOrHashMap.h"
4
5namespace MR
6{
7
10{
11 // source.id -> target.id
12 // each map here can be either dense vector or hash map, the type is set by the user and preserved by mesh copying functions;
13 // dense maps are better by speed and memory when source mesh is packed and must be copied entirely;
14 // hash maps minimize memory consumption when only a small portion of source mesh is copied
18
19 // target.id -> source.id
20 // dense vectors are better by speed and memory when target mesh was empty before copying
24
27};
28
31{
32public:
33 MRMESH_API Src2TgtMaps( FaceMap * outFmap, VertMap * outVmap, WholeEdgeMap * outEmap );
34 [[deprecated]] Src2TgtMaps( const MeshTopology &, FaceMap * outFmap, VertMap * outVmap, WholeEdgeMap * outEmap )
35 : Src2TgtMaps( outFmap, outVmap, outEmap ) {}
36 MRMESH_API ~Src2TgtMaps(); // maps are moved back to user here
37
38 operator const PartMapping &() const { return map_; }
39 const PartMapping & getPartMapping() const { return map_; }
40
41private:
42 FaceMap * outFmap_ = nullptr;
43 VertMap * outVmap_ = nullptr;
44 WholeEdgeMap * outEmap_ = nullptr;
45 PartMapping map_;
46 FaceMapOrHashMap src2tgtFaces_;
47 VertMapOrHashMap src2tgtVerts_;
48 WholeEdgeMapOrHashMap src2tgtEdges_;
49};
50
51using HashToVectorMappingConverter [[deprecated]] = Src2TgtMaps;
52
55{
56public:
57 MRMESH_API Tgt2SrcMaps( FaceMap * outFmap, VertMap * outVmap, WholeEdgeMap * outEmap );
58 MRMESH_API ~Tgt2SrcMaps(); // maps are moved back to user here
59
60 operator const PartMapping &() const { return map_; }
61 const PartMapping & getPartMapping() const { return map_; }
62
63private:
64 FaceMap * outFmap_ = nullptr;
65 VertMap * outVmap_ = nullptr;
66 WholeEdgeMap * outEmap_ = nullptr;
67 PartMapping map_;
68 FaceMapOrHashMap tgt2srcFaces_;
69 VertMapOrHashMap tgt2srcVerts_;
70 WholeEdgeMapOrHashMap tgt2srcEdges_;
71};
72
73} //namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:79
Definition MRMesh/MRMeshTopology.h:18
use this adapter to call functions expecting PartMapping parameter to receive src2tgt dense maps
Definition MRPartMapping.h:31
const PartMapping & getPartMapping() const
Definition MRPartMapping.h:39
MRMESH_API ~Src2TgtMaps()
MRMESH_API Src2TgtMaps(FaceMap *outFmap, VertMap *outVmap, WholeEdgeMap *outEmap)
Src2TgtMaps(const MeshTopology &, FaceMap *outFmap, VertMap *outVmap, WholeEdgeMap *outEmap)
Definition MRPartMapping.h:34
use this adapter to call functions expecting PartMapping parameter to receive tgt2src dense maps
Definition MRPartMapping.h:55
MRMESH_API ~Tgt2SrcMaps()
const PartMapping & getPartMapping() const
Definition MRPartMapping.h:61
MRMESH_API Tgt2SrcMaps(FaceMap *outFmap, VertMap *outVmap, WholeEdgeMap *outEmap)
Definition MRCameraOrientationPlugin.h:8
mapping among elements of source mesh, from which a part is taken, and target mesh
Definition MRPartMapping.h:10
MRMESH_API void clear()
clears all member maps
VertMapOrHashMap * tgt2srcVerts
Definition MRPartMapping.h:22
WholeEdgeMapOrHashMap * src2tgtEdges
Definition MRPartMapping.h:17
FaceMapOrHashMap * src2tgtFaces
Definition MRPartMapping.h:15
WholeEdgeMapOrHashMap * tgt2srcEdges
Definition MRPartMapping.h:23
VertMapOrHashMap * src2tgtVerts
Definition MRPartMapping.h:16
FaceMapOrHashMap * tgt2srcFaces
Definition MRPartMapping.h:21