21 #if !defined _ITERATOR_DEBUG_LEVEL
22 #define _ITERATOR_DEBUG_LEVEL 0
24 #if !defined MR_ITERATOR_DEBUG_LEVEL
25 #define MR_ITERATOR_DEBUG_LEVEL 0
27 #if _ITERATOR_DEBUG_LEVEL != MR_ITERATOR_DEBUG_LEVEL
28 #error _ITERATOR_DEBUG_LEVEL is inconsistent with MeshLib
34#define MR_CPP_STANDARD_DATE _MSVC_LANG
36#define MR_CPP_STANDARD_DATE __cplusplus
43#if MR_CPP_STANDARD_DATE < 201709 && !defined(__CUDACC__)
44#error Must enable C++20 or newer!
54#if defined(__GNUC__) && (__GNUC__ >= 13 && __GNUC__ <= 15)
55 #pragma GCC diagnostic push
56 #pragma GCC diagnostic ignored "-Warray-bounds"
57 #pragma GCC diagnostic ignored "-Wstringop-overflow"
62#if defined(__GNUC__) && (__GNUC__ >= 13 && __GNUC__ <= 15)
63 #pragma GCC diagnostic pop
68#include <parallel_hashmap/phmap_fwd_decl.h>
73# define MRMESH_API __declspec(dllexport)
75# define MRMESH_API __declspec(dllimport)
79# define MRMESH_API __attribute__((visibility("default")))
83# define MRMESH_CLASS __attribute__((visibility("default")))
145 ( UndirectedEdgeBitSet,
TypedBitSet<UndirectedEdgeId> )
164 ( UndirectedEdgeSetBitIterator,
SetBitIteratorT<UndirectedEdgeBitSet> )
172 ( Vector2ll,
Vector2<
long long> )
180 ( Vector3ll,
Vector3<
long long> )
188 ( Vector4ll,
Vector4<
long long> )
196 ( Matrix2ll,
Matrix2<
long long> )
204 ( Matrix3ll,
Matrix3<
long long> )
212 ( Matrix4ll,
Matrix4<
long long> )
278template <typename T> using Line2 =
Line<
Vector2<T>>;
307 ( Cone3d,
Cone3<
double> )
311template <typename V> using
Contour = std::vector<V>;
334 ( Plane3f,
Plane3<
float> )
335 ( Plane3d,
Plane3<
double> )
340 ( Box1ll,
Box<
long long> )
341 ( Box1f,
Box<
float> )
342 ( Box1d,
Box<
double> )
352template <typename T> using MinMax =
Box<T>;
361template<typename T, typename I> struct
MinArg;
362template<typename T, typename I> struct
MaxArg;
363template<typename T, typename I> struct
MinMaxArg;
366 ( Ball1f,
Ball<
float> )
367 ( Ball1d,
Ball<
double> )
373template <typename T> using Ball1 =
Ball<T>;
401template <typename T> using Triangle3 = std::array<
Vector3<T>, 3>;
460 ( FaceMap,
Vector<FaceId, FaceId> )
461 ( VertMap,
Vector<VertId, VertId> )
462 ( EdgeMap,
Vector<EdgeId, EdgeId> )
463 ( UndirectedEdgeMap,
Vector<UndirectedEdgeId, UndirectedEdgeId> )
464 ( ObjMap,
Vector<ObjId, ObjId> )
467 ( WholeEdgeMap,
Vector<EdgeId, UndirectedEdgeId> )
468 ( UndirectedEdge2RegionMap,
Vector<RegionId, UndirectedEdgeId> )
469 ( Face2RegionMap,
Vector<RegionId, FaceId> )
470 ( Vert2RegionMap,
Vector<RegionId, VertId> )
472 ( VertCoords,
Vector<Vector3f, VertId> )
473 ( VertCoords2,
Vector<Vector2f, VertId> )
474 ( VertNormals,
Vector<Vector3f, VertId> )
476 ( FaceNormals,
Vector<Vector3f, FaceId> )
478 ( TexturePerFace,
Vector<TextureId, FaceId> )
482 ( UndirectedEdgeColors,
Vector<
Color, UndirectedEdgeId> )
484 ( VertScalars,
Vector<
float, VertId> )
485 ( FaceScalars,
Vector<
float, FaceId> )
486 ( EdgeScalars,
Vector<
float, EdgeId> )
487 ( UndirectedEdgeScalars,
Vector<
float, UndirectedEdgeId> )
490using VertPredicate = std::function<
bool( VertId )>;
499[[nodiscard]] inline
bool contains( const std::function<
bool(
Id<T> )> & pred,
Id<T>
id )
501 return id.valid() && ( !pred || pred(
id ) );
517template <typename T, typename
Hash = phmap::priv::hash_default_hash<T>, typename
Eq = phmap::priv::hash_default_eq<T>>
518using HashSet = phmap::flat_hash_set<T,
Hash,
Eq>;
519template <typename T, typename
Hash = phmap::priv::hash_default_hash<T>, typename
Eq = phmap::priv::hash_default_eq<T>>
527template <typename K, typename V, typename
Hash = phmap::priv::hash_default_hash<K>, typename
Eq = phmap::priv::hash_default_eq<K>>
529template <typename K, typename V, typename
Hash = phmap::priv::hash_default_hash<K>, typename
Eq = phmap::priv::hash_default_eq<K>>
539template <typename K, typename V>
550template <typename T, typename I, typename P> class
Heap;
688constexpr inline T
sqr( T x )
noexcept {
return x * x; }
692constexpr inline int sgn( T x )
noexcept {
return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
696constexpr inline T
distance( T x, T y )
noexcept {
return x >= y ? x - y : y - x; }
703template <
typename V,
typename T>
704constexpr inline auto lerp( V v0, V v1, T t )
noexcept {
return ( 1 - t ) * v0 + t * v1; }
725struct VertDuplication;
731#ifdef __cpp_lib_unreachable
732# define MR_UNREACHABLE std::unreachable();
733# define MR_UNREACHABLE_NO_RETURN std::unreachable();
736# define MR_UNREACHABLE __builtin_unreachable();
737# define MR_UNREACHABLE_NO_RETURN __builtin_unreachable();
740# define MR_UNREACHABLE { assert( false ); return {}; }
741# define MR_UNREACHABLE_NO_RETURN assert( false );
#define MR_CANONICAL_TYPEDEFS(type_, name_, aliases_)
Definition MRCanonicalTypedefs.h:23
#define MRMESH_CLASS
Definition MRMesh/MRMeshFwd.h:83
Contour
Definition MRObjectLabel.h:16
Definition MRAABBTreeObjects.h:19
bounding volume hierarchy for point cloud structure
Definition MRAABBTreePoints.h:16
bounding volume hierarchy for line segments
Definition MRAABBTreePolyline.h:30
Definition MRAABBTree.h:16
Definition MRVisualObject.h:57
accumulates a number of (x,y) points to find the best-least-squares parabola approximating them
Definition MRBestFitParabola.h:12
container of bits
Definition MRMesh/MRBitSet.h:27
std::vector<V>-like container that is 1) resized without initialization of its elements,...
Definition MRBuffer.h:54
Undo action for ObjectMesh mesh change.
Definition MRChangeMeshAction.h:16
Undo action for ObjectMesh creases.
Definition MRChangeSelectionAction.h:122
Undo action for ObjectMesh edge selection.
Definition MRChangeSelectionAction.h:68
Undo action for ObjectMesh face selection.
Definition MRChangeSelectionAction.h:14
Undo action for ObjectMesh points only (not topology) change.
Definition MRChangeMeshAction.h:190
Undo action for ObjectMesh topology only (not points) change.
Definition MRChangeMeshAction.h:254
Definition MRChangeObjectAction.h:14
Undo action for ObjectPoints point selection.
Definition MRChangeSelectionAction.h:176
Definition MRChangeSceneAction.h:13
Definition MRChangeXfAction.h:13
Definition MRCircleObject.h:17
Class for aggregate several color map in one Color maps are aggregated according order.
Definition MRColorMapAggregator.h:17
Definition MRCombinedHistoryAction.h:12
Definition MRConeObject.h:19
Definition MRCylinder3.h:12
Definition MRCylinderObject.h:18
Definition MRDistanceMap.h:24
the class stores some number of smallest elements from a larger number of candidates
Definition MRFewSmallest.h:14
mathematical graph consisting from vertices and undirected edges
Definition MRGraph.h:14
stores map from element id in[0, size) to T;
Definition MRMesh/MRMeshFwd.h:550
Definition MRHistoryAction.h:12
Abstract class for fast approximate computation of generalized winding number for a mesh (using its A...
Definition MRFastWindingNumber.h:12
abstract class for computing the closest points of point clouds
Definition MRPointsProject.h:91
Abstract class, computes the closest point on mesh to each of given points. Pure virtual functions mu...
Definition MRMesh/MRPointsToMeshProjector.h:13
Definition MRMesh/MRId.h:14
Definition MRMesh/MRLaplacian.h:34
Definition MRLineObject.h:12
Definition MRMesh/MRMeshOrPoints.h:17
Definition MRMesh/MRMeshTopology.h:18
Definition MRMesh/MRId.h:62
Definition MRObjectDistanceMap.h:13
Definition MRObjectGcode.h:14
Definition MRObjectLabel.h:25
Definition MRObjectLinesHolder.h:19
Definition MRObjectLines.h:11
Definition MRObjectMeshHolder.h:31
Definition MRObjectMesh.h:11
Definition MRObjectPointsHolder.h:18
Definition MRObjectPoints.h:11
named object in the data model
Definition MRObject.h:60
Definition MRPlaneObject.h:12
Class to accumulate points and make best line / plane approximation.
Definition MRBestFit.h:19
Definition MRPointObject.h:13
Definition MRPolylineTopology.h:15
Object that is parent of all scene.
Definition MRSceneRoot.h:11
iterator to enumerate all indices with set bits in BitSet class or its derivatives
Definition MRMesh/MRBitSet.h:261
Definition MRSharedThreadSafeOwner.h:19
Definition MRSphereObject.h:15
Definition MRSwapRootAction.h:13
container of bits representing specific indices (faces, verts or edges)
Definition MRMesh/MRBitSet.h:132
Union-find data structure for representing disjoin sets of elements with few very quick operations: 1...
Definition MRUnionFind.h:20
Definition MRUniqueThreadSafeOwner.h:18
std::vector<T>-like container that requires specific indexing type,
Definition MRMesh/MRVector.h:19
Definition MRViewportId.h:16
stores mask of viewport unique identifiers
Definition MRViewportId.h:38
Visual Object.
Definition MRVisualObject.h:121
graphs representing rain basins on the mesh
Definition MRWatershedGraph.h:12
bool contains(const TypedBitSet< I > *bitset, I id)
Definition MRMesh/MRBitSet.h:247
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:663
std::optional< T > distanceSq(const Plane3< T > &plane1, const Plane3< T > &plane2, T errorLimit=std::numeric_limits< T >::epsilon() *T(20))
Definition MRIntersection.h:90
std::optional< T > distance(const Plane3< T > &plane1, const Plane3< T > &plane2, T errorLimit=std::numeric_limits< T >::epsilon() *T(20))
Definition MRIntersection.h:104
@ None
special value not to limit path in one slice
Definition MRVoxelPath.h:33
Definition MRCameraOrientationPlugin.h:8
std::function< float(VertId)> VertMetric
Definition MRMesh/MRMeshFwd.h:504
phmap::parallel_flat_hash_map< K, V, Hash, Eq > ParallelHashMap
Definition MRMesh/MRMeshFwd.h:530
std::vector< EdgeId > EdgeLoop
Definition MRMesh/MRMeshFwd.h:136
std::vector< std::string > GcodeSource
Definition MRMesh/MRMeshFwd.h:604
WrapType
Definition MRMesh/MRMeshFwd.h:672
std::vector< SurfacePath > SurfacePaths
Definition MRMesh/MRMeshFwd.h:417
std::vector< EdgeLoop > EdgeLoops
Definition MRMesh/MRMeshFwd.h:137
class MRMESH_CLASS UndirectedEdgeTag
Definition MRMesh/MRMeshFwd.h:94
constexpr T sqr(T x) noexcept
squared value
Definition MRMesh/MRMeshFwd.h:688
Cylinder3f
Definition MRMesh/MRMeshFwd.h:301
AABBTreePolyline2
Definition MRMesh/MRMeshFwd.h:583
Contour3< double > Contour3d
Definition MRMesh/MRMeshFwd.h:316
class MRMESH_CLASS ObjTag
Definition MRMesh/MRMeshFwd.h:101
Eq
Definition MRMesh/MRMeshFwd.h:517
std::function< bool(FaceId)> FacePredicate
Definition MRMesh/MRMeshFwd.h:491
MinMax< float > MinMaxf
Definition MRMesh/MRMeshFwd.h:353
Contour2< double > Contour2d
Definition MRMesh/MRMeshFwd.h:314
class MRMESH_CLASS NodeTag
Definition MRMesh/MRMeshFwd.h:100
HashSet< VertId > VertHashSet
Definition MRMesh/MRMeshFwd.h:524
std::function< bool(EdgeId)> EdgePredicate
Definition MRMesh/MRMeshFwd.h:492
Hash
Definition MRMesh/MRMeshFwd.h:517
Contour2< float > Contour2f
Definition MRMesh/MRMeshFwd.h:315
Contours2< double > Contours2d
Definition MRMesh/MRMeshFwd.h:322
std::function< bool(UndirectedEdgeId)> UndirectedEdgePredicate
Definition MRMesh/MRMeshFwd.h:493
SurfacePaths PlaneSections
Definition MRMesh/MRMeshFwd.h:421
HashMap< VertId, VertId > VertHashMap
Definition MRMesh/MRMeshFwd.h:533
class MRMESH_CLASS VoxelTag
Definition MRMesh/MRMeshFwd.h:98
FilterType
Definition MRMesh/MRMeshFwd.h:666
SurfacePath IsoLine
Definition MRMesh/MRMeshFwd.h:418
Vector2f UVCoord
Definition MRMesh/MRMeshFwd.h:447
Triangle3< int > Triangle3i
Definition MRMesh/MRMeshFwd.h:402
MRMESH_CLASS Vector3b
Definition MRMesh/MRMeshFwd.h:178
std::vector< MeshEdgePoint > SurfacePath
Definition MRMesh/MRMeshFwd.h:416
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:537
class MRMESH_CLASS FaceTag
Definition MRMesh/MRMeshFwd.h:95
class MRMESH_CLASS TextureTag
Definition MRMesh/MRMeshFwd.h:102
class MRMESH_CLASS PixelTag
Definition MRMesh/MRMeshFwd.h:97
Contours< Vector2< T > > Contours2
Definition MRMesh/MRMeshFwd.h:320
MRMESH_CLASS Vector3< double > Matrix2< double > Matrix4< double > SymMatrix3< double > AffineXf2f
Definition MRMesh/MRMeshFwd.h:242
overloaded(Ts...) -> overloaded< Ts... >
MRMESH_CLASS Vector3< double > Matrix2< double > Matrix4b
Definition MRMesh/MRMeshFwd.h:210
constexpr int sgn(T x) noexcept
sign of given value in { -1, 0, 1 }
Definition MRMesh/MRMeshFwd.h:692
Contours2< float > Contours2f
Definition MRMesh/MRMeshFwd.h:323
RigidScaleXf3f
Definition MRMesh/MRMeshFwd.h:256
std::function< float(EdgeId)> EdgeMetric
Definition MRMesh/MRMeshFwd.h:506
MinMax< double > MinMaxd
Definition MRMesh/MRMeshFwd.h:354
std::function< bool(EdgeId edgeToCollapse, const Vector3f &newEdgeOrgPos)> PreCollapseCallback
Definition MRMesh/MRMeshFwd.h:495
MinMax< int > MinMaxi
Definition MRMesh/MRMeshFwd.h:355
Contour< Vector2< T > > Contour2
Definition MRMesh/MRMeshFwd.h:312
SurfacePath PlaneSection
Definition MRMesh/MRMeshFwd.h:420
HashMap< FaceId, FaceId > FaceHashMap
Definition MRMesh/MRMeshFwd.h:532
std::function< float(FaceId)> FaceMetric
Definition MRMesh/MRMeshFwd.h:505
Triangle3< double > Triangle3d
Definition MRMesh/MRMeshFwd.h:404
Box1i
Definition MRMesh/MRMeshFwd.h:339
Contour< Vector3< T > > Contour3
Definition MRMesh/MRMeshFwd.h:313
HashSet< FaceId > FaceHashSet
Definition MRMesh/MRMeshFwd.h:523
std::vector< EdgeId > EdgePath
Definition MRMesh/MRMeshFwd.h:135
std::array< VertId, 3 > ThreeVertIds
three vertex ids describing a triangle topology
Definition MRMesh/MRMeshFwd.h:450
class MRMESH_CLASS VertTag
Definition MRMesh/MRMeshFwd.h:96
std::pair< FaceId, FaceId > FacePair
Definition MRMesh/MRMeshFwd.h:426
constexpr NoInit noInit
Definition MRMesh/MRMeshFwd.h:90
HashSet< EdgeId > EdgeHashSet
Definition MRMesh/MRMeshFwd.h:525
std::pair< UndirectedEdgeId, UndirectedEdgeId > UndirectedEdgePair
Definition MRMesh/MRMeshFwd.h:428
Cone3f
Definition MRMesh/MRMeshFwd.h:306
BestFitParabolaf
Definition MRMesh/MRMeshFwd.h:296
std::pair< EdgeId, EdgeId > EdgePair
Definition MRMesh/MRMeshFwd.h:427
std::function< void(EdgeId e1, EdgeId e)> OnEdgeSplit
Definition MRMesh/MRMeshFwd.h:496
std::function< float(UndirectedEdgeId)> UndirectedEdgeMetric
Definition MRMesh/MRMeshFwd.h:507
constexpr auto lerp(V v0, V v1, T t) noexcept
Linear interpolation: returns v0 when t==0 and v1 when t==1.
Definition MRMesh/MRMeshFwd.h:704
constexpr bool dependent_false
Definition MRMesh/MRMeshFwd.h:707
Triangle3< float > Triangle3f
Definition MRMesh/MRMeshFwd.h:403
SurfacePaths IsoLines
Definition MRMesh/MRMeshFwd.h:419
class MRMESH_CLASS EdgeTag
Definition MRMesh/MRMeshFwd.h:93
Contours3< float > Contours3f
Definition MRMesh/MRMeshFwd.h:325
std::vector< Contour< V > > Contours
Definition MRMesh/MRMeshFwd.h:319
Polyline2ProjectionWithOffsetResult
Definition MRMesh/MRMeshFwd.h:596
HashMap< EdgeId, EdgeId > EdgeHashMap
Definition MRMesh/MRMeshFwd.h:534
phmap::parallel_flat_hash_set< T, Hash, Eq > ParallelHashSet
Definition MRMesh/MRMeshFwd.h:520
MRMESH_CLASS Vector3< double > Matrix2b
Definition MRMesh/MRMeshFwd.h:194
std::pair< VertId, VertId > VertPair
Definition MRMesh/MRMeshFwd.h:425
Contour3< float > Contour3f
Definition MRMesh/MRMeshFwd.h:317
HashMap< UndirectedEdgeId, UndirectedEdgeId > UndirectedEdgeHashMap
Definition MRMesh/MRMeshFwd.h:535
Contours< Vector3< T > > Contours3
Definition MRMesh/MRMeshFwd.h:321
Contours3< double > Contours3d
Definition MRMesh/MRMeshFwd.h:324
NoInitNodeId
Definition MRMesh/MRMeshFwd.h:122
class MRMESH_CLASS RegionTag
Definition MRMesh/MRMeshFwd.h:99
MRMESH_CLASS Vector3< double > Matrix2< double > Matrix4< double > SymMatrix3b
Definition MRMesh/MRMeshFwd.h:226
class MRMESH_CLASS GraphVertTag
Definition MRMesh/MRMeshFwd.h:103
phmap::flat_hash_map< K, V, Hash, Eq > HashMap
Definition MRMesh/MRMeshFwd.h:528
class MRMESH_CLASS GraphEdgeTag
Definition MRMesh/MRMeshFwd.h:104
Reorder
determines how points to be ordered
Definition MRMesh/MRMeshFwd.h:680
@ Lexicographically
the order is determined by lexicographical sorting by coordinates (optimal for uniform sampling)
Definition MRMesh/MRAffineXf.h:14
triangulations for all points, with easy access by VertId
Definition MRLocalTriangulations.h:48
flat map: I -> T
Definition MRBuffer.h:143
a ball = points surrounded by a sphere in arbitrary space with vector type V
Definition MRBall.h:12
Box given by its min- and max- corners.
Definition MRMesh/MRBox.h:25
Definition MRCloudPartMapping.h:10
Definition MRMesh/MRColor.h:9
Cubic Bezier curve.
Definition MRBezier.h:13
options determining computation of distance from a point to a mesh
Definition MRDistanceToMeshOptions.h:11
Definition MREdgeLengthMesh.h:13
two edge-points (e.g. representing collision point of two edges)
Definition MREdgePoint.h:50
encodes a point on an edge of mesh or of polyline
Definition MREdgePoint.h:11
Represents a segment on one edge.
Definition MREdgePoint.h:61
settings defining regular grid, where each quadrangular cell is split on two triangles in one of two ...
Definition MRGridSettings.h:11
Definition MRMesh/MRMeshFwd.h:588
Definition MRMesh/MRMeshFwd.h:441
Definition MRMesh/MRMeshFwd.h:443
Definition MRLineSegm.h:11
result of loading (e.g. from a file) as a number of objects
Definition MRLoadedObjects.h:28
Definition MRMesh/MRMeshFwd.h:540
Definition MRMatrix2.h:19
Definition MRMesh/MRMatrix3.h:19
Definition MRMatrix4.h:20
Definition MRMinMaxArg.h:46
Definition MRMeshIntersect.h:17
an object and its transformation to global space with other objects
Definition MRMesh/MRMeshOrPoints.h:97
Definition MRMesh/MRMeshProject.h:18
Definition MRMesh/MRMeshPart.h:12
Definition MRMeshTexture.h:13
Definition MRMesh/MRMeshTriPoint.h:23
Definition MRMesh/MRMesh.h:22
Definition MRMinMaxArg.h:13
Definition MRMinMaxArg.h:79
Definition MRNoDefInit.h:11
Definition MRMesh/MRMeshFwd.h:89
mesh and its per-element attributes for ObjectMeshHolder
Definition MRObjectMeshData.h:12
Definition MRBuffer.h:151
Represents quadratic function f(x) = a*x*x + b*x + c.
Definition MRParabola.h:11
mapping among elements of source mesh, from which a part is taken, and target mesh
Definition MRPartMapping.h:10
Definition MRMesh/MRPointCloud.h:16
a point located on some mesh's face
Definition MRMesh/MRPointOnFace.h:11
Definition MRPointOnObject.h:17
Definition MRPointsProject.h:15
Definition MRPolylineProject.h:15
Definition MRPolylineProject.h:73
Definition MRPolyline.h:18
Definition MRQuaternion.h:13
Definition MRRigidScaleXf3.h:12
Definition MRRigidXf3.h:13
encodes a point inside a line segment using relative distance in [0,1]
Definition MRSegmPoint.h:14
options determining computation of signed distance from a point to a mesh
Definition MRDistanceToMeshOptions.h:37
describes a number of local triangulations of some points (e.g. assigned to a thread)
Definition MRLocalTriangulations.h:40
Definition MRSymMatrix2.h:14
Definition MRSymMatrix3.h:15
Definition MRSymMatrix4.h:13
Definition MRTbbTaskArenaAndGroup.h:13
Definition MRTriMesh.h:13
encodes a point inside a triangle using barycentric coordinates
Definition MRMesh/MRTriPoint.h:14
Definition MRUnorientedTriangle.h:13
Definition MRVector2.h:25
Definition MRMesh/MRVector3.h:26
Definition MRVector4.h:20
Definition MRMesh/MRMeshFwd.h:710