MeshLib
 
Loading...
Searching...
No Matches
MRIdentifyVertices.h
Go to the documentation of this file.
1#pragma once
2
4#include "MRVector3.h"
5#include "MRVector.h"
6#include "MRphmap.h"
7#include <cstring>
8
9namespace MR
10{
11
12namespace MeshBuilder
13{
14
17{
18 bool operator() ( const Vector3f & a, const Vector3f & b ) const
19 {
20 static_assert( sizeof( Vector3f ) == 12 );
21 char ax[12], bx[12];
22 std::memcpy( ax, &a, 12 );
23 std::memcpy( bx, &b, 12 );
24 return std::memcmp( ax, bx, 12 ) == 0;
25 }
26};
27
33{
34public:
36 MRMESH_API void reserve( size_t numTris );
38 MRMESH_API void addTriangles( const std::vector<Triangle3f> & buffer );
40 size_t numTris() const { return t_.size(); }
42 Triangulation takeTriangulation() { return std::move( t_ ); }
44 VertCoords takePoints() { return std::move( points_ ); }
45
46private:
47 using VertInHMap = std::array<VertId*, 3>;
48 std::vector<VertInHMap> vertsInHMap_;
50 HMap hmap_;
52 VertCoords points_;
53};
54
55} //namespace MeshBuilder
56
57} //namespace MR
List< Vector3f^> VertCoords
Definition MRDotNet/MRMeshFwd.h:95
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
Definition MRIdentifyVertices.h:33
MRMESH_API void addTriangles(const std::vector< Triangle3f > &buffer)
identifies vertices from a chunk of triangles
Triangulation takeTriangulation()
obtains triangulation with vertex ids
Definition MRIdentifyVertices.h:42
VertCoords takePoints()
obtains coordinates of unique points in the order of vertex ids
Definition MRIdentifyVertices.h:44
MRMESH_API void reserve(size_t numTris)
prepare identification of vertices from given this number of triangles
size_t numTris() const
returns the number of triangles added so far
Definition MRIdentifyVertices.h:40
represents a 3-dimentional float-typed vector
Definition MRDotNet/MRVector3.h:8
Definition MRCameraOrientationPlugin.h:7
phmap::parallel_flat_hash_map< K, V, Hash, Eq > ParallelHashMap
Definition MRMesh/MRMeshFwd.h:452
Vector3< float > Vector3f
Definition MRDotNet/MRMeshFwd.h:8
Definition Triangulation.dox.py:1
this makes bit-wise comparison of two Vector3f's thus making two NaNs equal
Definition MRIdentifyVertices.h:17
bool operator()(const Vector3f &a, const Vector3f &b) const
Definition MRIdentifyVertices.h:18