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