MeshLib C++ Docs
Loading...
Searching...
No Matches
MRMesh/MRMeshFwd.h
Go to the documentation of this file.
1#pragma once
2
3#include "config.h"
4
6
7// Not-zero _ITERATOR_DEBUG_LEVEL in Microsoft STL greatly reduces the performance of STL containers.
8//
9// Pre-build binaries from MeshLib distribution are prepared with _ITERATOR_DEBUG_LEVEL=0,
10// and if you build MeshLib by yourself then _ITERATOR_DEBUG_LEVEL=0 is also selected see
11// 1) vcpkg/triplets/x64-windows-meshlib.cmake and
12// 2) MeshLib/source/common.props
13// Please note that all other modules (.exe, .dll, .lib) with MS STL calls in your application also need
14// to define exactly the same value of _ITERATOR_DEBUG_LEVEL to be operational after linking.
15//
16// If you deliberately would like to work with not zero _ITERATOR_DEBUG_LEVEL, then please define
17// additionally MR_ITERATOR_DEBUG_LEVEL with the same value to indicate that it is done intentionally
18// (and you are ok with up to 100x slowdown).
19//
20#if defined _MSC_VER
21 #if !defined _ITERATOR_DEBUG_LEVEL
22 #define _ITERATOR_DEBUG_LEVEL 0
23 #endif
24 #if !defined MR_ITERATOR_DEBUG_LEVEL
25 #define MR_ITERATOR_DEBUG_LEVEL 0
26 #endif
27 #if _ITERATOR_DEBUG_LEVEL != MR_ITERATOR_DEBUG_LEVEL
28 #error _ITERATOR_DEBUG_LEVEL is inconsistent with MeshLib
29 #endif
30#endif
31
32// Check C++ version.
33#ifdef _MSC_VER
34#define MR_CPP_STANDARD_DATE _MSVC_LANG
35#else
36#define MR_CPP_STANDARD_DATE __cplusplus
37#endif
38// Note `201709`. C++20 usually sets `202002`, while C++17 sets `201703`.
39// This `201709` is what GCC 10 sets on `-std=c++20` (presumably to indicate incomplete implementation?).
40// Other compilers we use don't have this issue.
41// Also note `__CUDACC__` - currently our Cuda code is compiled as C++17 (compiler doesn't support C++20?),
42// and we carefully avoid headers incomaptible with C++17.
43#if MR_CPP_STANDARD_DATE < 201709 && !defined(__CUDACC__)
44#error Must enable C++20 or newer!
45#endif
46// -- Curently we have no macros that don't work with the old preprocessor. Leaving the check here to possibly be enabled later.
47// Reject old MSVC preprocessor.
48// Note that we exclude Cuda here. Not 100% sure if it has a good preprocessor, or we just avoid including the headers sensitive to it in Cuda.
49// #if defined(_MSC_VER) && !defined(__clang__) && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL == 1) && !defined(__CUDACC__)
50// #error MSVC users must enable the new standard-conformant preprocessor using `/Zc:preprocessor`!
51// #endif
52
53
54#include <array>
55#include <vector>
56#include <string>
57#include <parallel_hashmap/phmap_fwd_decl.h>
58#include <functional>
59
60#ifdef _WIN32
61# ifdef MRMESH_EXPORT
62# define MRMESH_API __declspec(dllexport)
63# else
64# define MRMESH_API __declspec(dllimport)
65# endif
66# define MRMESH_CLASS
67#else
68# define MRMESH_API __attribute__((visibility("default")))
69// to fix undefined reference to `typeinfo/vtable`
70// Also it's important to use this on any type for which `typeid` is used in multiple shared libraries, and then passed across library boundaries.
71// Otherwise on Mac the resulting typeids will incorrectly compare not equal.
72# define MRMESH_CLASS __attribute__((visibility("default")))
73#endif
74
75namespace MR
76{
77
78struct NoInit {};
79inline constexpr NoInit noInit;
80template <typename T> struct MRMESH_CLASS NoDefInit;
81
94
95MR_CANONICAL_TYPEDEFS( (template <typename T> class MRMESH_CLASS), Id,
96 ( EdgeId, Id<EdgeTag> )
97 ( UndirectedEdgeId, Id<UndirectedEdgeTag> )
98 ( FaceId, Id<FaceTag> )
99 ( VertId, Id<VertTag> )
100 ( PixelId, Id<PixelTag> )
101 ( VoxelId, Id<VoxelTag> )
102 ( RegionId, Id<RegionTag> )
103 ( NodeId, Id<NodeTag> )
104 ( ObjId, Id<ObjTag> )
105 ( TextureId, Id<TextureTag> )
106 ( GraphVertId, Id<GraphVertTag> )
107 ( GraphEdgeId, Id<GraphEdgeTag> )
108)
109
110template <typename T, typename I = size_t> class MRMESH_CLASS Buffer;
111struct PackMapping;
112
113class ViewportId;
114class ViewportMask;
115
116struct UnorientedTriangle;
119
120using EdgePath = std::vector<EdgeId>;
121using EdgeLoop = std::vector<EdgeId>;
122using EdgeLoops = std::vector<EdgeLoop>;
123
125
126MR_CANONICAL_TYPEDEFS( (template <typename T> class MRMESH_CLASS), TaggedBitSet,
127 ( FaceBitSet, TaggedBitSet<FaceTag> )
128 ( VertBitSet, TaggedBitSet<VertTag> )
129 ( EdgeBitSet, TaggedBitSet<EdgeTag> )
130 ( UndirectedEdgeBitSet, TaggedBitSet<UndirectedEdgeTag> )
131 ( PixelBitSet, TaggedBitSet<PixelTag> )
132 ( VoxelBitSet, TaggedBitSet<VoxelTag> )
133 ( RegionBitSet, TaggedBitSet<RegionTag> )
134 ( NodeBitSet, TaggedBitSet<NodeTag> )
135 ( ObjBitSet, TaggedBitSet<ObjTag> )
136 ( TextureBitSet, TaggedBitSet<TextureTag> )
137 ( GraphVertBitSet, TaggedBitSet<GraphVertTag> )
138 ( GraphEdgeBitSet, TaggedBitSet<GraphEdgeTag> )
139)
140
141MR_CANONICAL_TYPEDEFS( (template <typename T> class MRMESH_CLASS), SetBitIteratorT,
143 ( FaceSetBitIterator, SetBitIteratorT<FaceBitSet> )
144 ( VertSetBitIterator, SetBitIteratorT<VertBitSet> )
145 ( EdgeSetBitIterator, SetBitIteratorT<EdgeBitSet> )
146 ( UndirectedEdgeSetBitIterator, SetBitIteratorT<UndirectedEdgeBitSet> )
147)
148
149struct Color;
150
151MR_CANONICAL_TYPEDEFS( (template <typename T> struct), MRMESH_CLASS Vector2,
152 ( Vector2b, Vector2<bool> )
153 ( Vector2i, Vector2<int> )
154 ( Vector2ll, Vector2<long long> )
155 ( Vector2f, Vector2<float> )
156 ( Vector2d, Vector2<double> )
157)
158
159MR_CANONICAL_TYPEDEFS( (template <typename T> struct), MRMESH_CLASS Vector3,
160 ( Vector3b, Vector3<bool> )
161 ( Vector3i, Vector3<int> )
162 ( Vector3ll, Vector3<long long> )
163 ( Vector3f, Vector3<float> )
164 ( Vector3d, Vector3<double> )
165)
166
167MR_CANONICAL_TYPEDEFS( (template <typename T> struct), Vector4,
168 ( Vector4b, Vector4<bool> )
169 ( Vector4i, Vector4<int> )
170 ( Vector4ll, Vector4<long long> )
171 ( Vector4f, Vector4<float> )
172 ( Vector4d, Vector4<double> )
173)
174
175MR_CANONICAL_TYPEDEFS( (template <typename T> struct), Matrix2,
176 ( Matrix2b, Matrix2<bool> )
177 ( Matrix2i, Matrix2<int> )
178 ( Matrix2ll, Matrix2<long long> )
179 ( Matrix2f, Matrix2<float> )
180 ( Matrix2d, Matrix2<double> )
181)
182
183MR_CANONICAL_TYPEDEFS( (template <typename T> struct), Matrix3,
184 ( Matrix3b, Matrix3<bool> )
185 ( Matrix3i, Matrix3<int> )
186 ( Matrix3ll, Matrix3<long long> )
187 ( Matrix3f, Matrix3<float> )
188 ( Matrix3d, Matrix3<double> )
189)
190
191MR_CANONICAL_TYPEDEFS( (template <typename T> struct), Matrix4,
192 ( Matrix4b, Matrix4<bool> )
193 ( Matrix4i, Matrix4<int> )
194 ( Matrix4ll, Matrix4<long long> )
195 ( Matrix4f, Matrix4<float> )
196 ( Matrix4d, Matrix4<double> )
197)
198
199MR_CANONICAL_TYPEDEFS( (template <typename T> struct), SymMatrix2,
200 ( SymMatrix2b, SymMatrix2<bool> )
201 ( SymMatrix2i, SymMatrix2<int> )
202 ( SymMatrix2ll, SymMatrix2<long long> )
203 ( SymMatrix2f, SymMatrix2<float> )
204 ( SymMatrix2d, SymMatrix2<double> )
205)
206
207MR_CANONICAL_TYPEDEFS( (template <typename T> struct), SymMatrix3,
209 ( SymMatrix3i, SymMatrix3<int> )
210 ( SymMatrix3ll, SymMatrix3<long long> )
211 ( SymMatrix3f, SymMatrix3<float> )
212 ( SymMatrix3d, SymMatrix3<double> )
213)
214
215MR_CANONICAL_TYPEDEFS( (template <typename T> struct), SymMatrix4,
216 ( SymMatrix4b, SymMatrix4<bool> )
217 ( SymMatrix4i, SymMatrix4<int> )
218 ( SymMatrix4ll, SymMatrix4<long long> )
219 ( SymMatrix4f, SymMatrix4<float> )
220 ( SymMatrix4d, SymMatrix4<double> )
221)
222
223MR_CANONICAL_TYPEDEFS( (template <typename V> struct), AffineXf,
225 ( AffineXf2d, AffineXf<Vector2<double>> )
226 ( AffineXf3f, AffineXf<Vector3<float>> )
227 ( AffineXf3d, AffineXf<Vector3<double>> )
228)
229template <typename T> using AffineXf2 = AffineXf<Vector2<T>>;
230template <typename T> using AffineXf3 = AffineXf<Vector3<T>>;
231
232MR_CANONICAL_TYPEDEFS( (template <typename T> struct), RigidXf3,
233 ( RigidXf3f, RigidXf3<float> )
234 ( RigidXf3d, RigidXf3<double> )
235)
236
237MR_CANONICAL_TYPEDEFS( (template <typename T> struct), RigidScaleXf3,
239 ( RigidScaleXf3d, RigidScaleXf3<double> )
240)
241
244
245MR_CANONICAL_TYPEDEFS( (template <typename T> struct), Sphere,
246 ( Sphere2f, Sphere<Vector2<float>> )
247 ( Sphere2d, Sphere<Vector2<double>> )
248 ( Sphere3f, Sphere<Vector3<float>> )
249 ( Sphere3d, Sphere<Vector3<double>> )
250)
251template <typename T> using Sphere2 = Sphere<Vector2<T>>;
252template <typename T> using Sphere3 = Sphere<Vector3<T>>;
253
254MR_CANONICAL_TYPEDEFS( (template <typename V> struct), Line,
255 ( Line2f, Line<Vector2<float>> )
256 ( Line2d, Line<Vector2<double>> )
257 ( Line3f, Line<Vector3<float>> )
258 ( Line3d, Line<Vector3<double>> )
259)
260template <typename T> using Line2 = Line<Vector2<T>>;
261template <typename T> using Line3 = Line<Vector3<T>>;
262
263MR_CANONICAL_TYPEDEFS( (template <typename V> struct), LineSegm,
264 ( LineSegm2f, LineSegm<Vector2<float>> )
265 ( LineSegm2d, LineSegm<Vector2<double>> )
266 ( LineSegm3f, LineSegm<Vector3<float>> )
267 ( LineSegm3d, LineSegm<Vector3<double>> )
268)
269template <typename T> using LineSegm2 = LineSegm<Vector2<T>>;
270template <typename T> using LineSegm3 = LineSegm<Vector3<T>>;
271
272MR_CANONICAL_TYPEDEFS( (template <typename T> struct), Parabola,
273 ( Parabolaf, Parabola<float> )
274 ( Parabolad, Parabola<double> )
275)
276
277MR_CANONICAL_TYPEDEFS( (template <typename T> class), BestFitParabola,
279 ( BestFitParabolad, BestFitParabola<double> )
280)
281
282MR_CANONICAL_TYPEDEFS( (template <typename T> class), Cylinder3,
284 ( Cylinder3d, Cylinder3<double> )
285)
286
287MR_CANONICAL_TYPEDEFS( (template <typename T> class), Cone3,
288 ( Cone3f, Cone3<float> )
289 ( Cone3d, Cone3<double> )
290)
291
292// No canonical typedefs here, because those ultimately boil to `std::vector`, which isn't under our control.
293template <typename V> using Contour = std::vector<V>;
294template <typename T> using Contour2 = Contour<Vector2<T>>;
295template <typename T> using Contour3 = Contour<Vector3<T>>;
296using Contour2d = Contour2<double>;
297using Contour2f = Contour2<float>;
298using Contour3d = Contour3<double>;
299using Contour3f = Contour3<float>;
300
301template <typename V> using Contours = std::vector<Contour<V>>;
302template <typename T> using Contours2 = Contours<Vector2<T>>;
303template <typename T> using Contours3 = Contours<Vector3<T>>;
304using Contours2d = Contours2<double>;
305using Contours2f = Contours2<float>;
306using Contours3d = Contours3<double>;
307using Contours3f = Contours3<float>;
308
309template <typename T> using Contour3 = Contour<Vector3<T>>;
310using Contour3d = Contour3<double>;
311using Contours3d = std::vector<Contour3d>;
312using Contour3f = Contour3<float>;
313using Contours3f = std::vector<Contour3f>;
314
315MR_CANONICAL_TYPEDEFS( (template <typename T> struct), Plane3,
316 ( Plane3f, Plane3<float> )
317 ( Plane3d, Plane3<double> )
318)
319
320MR_CANONICAL_TYPEDEFS( (template <typename V> struct MRMESH_CLASS), Box,
321 ( Box1i, Box<int> )
322 ( Box1ll, Box<long long> )
323 ( Box1f, Box<float> )
324 ( Box1d, Box<double> )
325 ( Box2i, Box<Vector2<int>> )
326 ( Box2ll, Box<Vector2<long long>> )
327 ( Box2f, Box<Vector2<float>> )
328 ( Box2d, Box<Vector2<double>> )
329 ( Box3i, Box<Vector3<int>> )
330 ( Box3ll, Box<Vector3<long long>> )
331 ( Box3f, Box<Vector3<float>> )
332 ( Box3d, Box<Vector3<double>> )
333)
334template <typename T> using MinMax = Box<T>;
335using MinMaxf = MinMax<float>;
336using MinMaxd = MinMax<double>;
337
338template <typename T> using Box1 = Box<T>;
339template <typename T> using Box2 = Box<Vector2<T>>;
340template <typename T> using Box3 = Box<Vector3<T>>;
341
342MR_CANONICAL_TYPEDEFS( (template <typename V> struct), QuadraticForm,
343 ( QuadraticForm2f, QuadraticForm<Vector2<float>> )
344 ( QuadraticForm2d, QuadraticForm<Vector2<double>> )
345 ( QuadraticForm3f, QuadraticForm<Vector3<float>> )
346 ( QuadraticForm3d, QuadraticForm<Vector3<double>> )
347)
348template <typename T> using QuadraticForm2 = QuadraticForm<Vector2<T>>;
349template <typename T> using QuadraticForm3 = QuadraticForm<Vector3<T>>;
350
351MR_CANONICAL_TYPEDEFS( (template <typename T> struct), Quaternion,
352 ( Quaternionf, Quaternion<float> )
353 ( Quaterniond, Quaternion<double> )
354)
355
356// No canonical typedefs because `std::array` is not under our control.
357template <typename T> using Triangle3 = std::array<Vector3<T>, 3>;
358using Triangle3i = Triangle3<int>;
359using Triangle3f = Triangle3<float>;
360using Triangle3d = Triangle3<double>;
361
362class PointAccumulator;
363
364MR_CANONICAL_TYPEDEFS( (template <typename T> struct), SegmPoint,
365 ( SegmPointf, SegmPoint<float> )
366 ( SegmPointd, SegmPoint<double> )
367)
368
369struct EdgePoint;
370struct EdgeSegment;
372using SurfacePath = std::vector<MeshEdgePoint>;
373using SurfacePaths = std::vector<SurfacePath>;
378struct EdgePointPair;
379class Laplacian;
380
381using VertPair = std::pair<VertId, VertId>;
382using FacePair = std::pair<FaceId, FaceId>;
383using EdgePair = std::pair<EdgeId, EdgeId>;
384using UndirectedEdgePair = std::pair<UndirectedEdgeId, UndirectedEdgeId>;
385
386MR_CANONICAL_TYPEDEFS( (template <typename T> struct), TriPoint,
387 ( TriPointf, TriPoint<float> )
388 ( TriPointd, TriPoint<double> )
389)
390
391struct PointOnFace;
392struct PointOnObject;
393struct MeshTriPoint;
396template <typename T> struct IntersectionPrecomputes;
397
398template <typename I> struct IteratorRange;
399
402using UVCoord = Vector2f;
403
405using ThreeVertIds = std::array<VertId, 3>;
406
408
409MR_CANONICAL_TYPEDEFS( (template <typename T, typename I> class MRMESH_CLASS), Vector,
411 ( Triangulation, Vector<ThreeVertIds, FaceId> )
412
413 ( Dipoles, Vector<Dipole, NodeId> )
414
415 ( FaceMap, Vector<FaceId, FaceId> )
416 ( VertMap, Vector<VertId, VertId> )
417 ( EdgeMap, Vector<EdgeId, EdgeId> )
418 ( UndirectedEdgeMap, Vector<UndirectedEdgeId, UndirectedEdgeId> )
419 ( ObjMap, Vector<ObjId, ObjId> )
420
422 ( WholeEdgeMap, Vector<EdgeId, UndirectedEdgeId> )
423 ( UndirectedEdge2RegionMap, Vector<RegionId, UndirectedEdgeId> )
424 ( Face2RegionMap, Vector<RegionId, FaceId> )
425 ( Vert2RegionMap, Vector<RegionId, VertId> )
426
427 ( VertCoords, Vector<Vector3f, VertId> )
428 ( VertNormals, Vector<Vector3f, VertId> )
429 ( VertUVCoords, Vector<UVCoord, VertId> )
430 ( FaceNormals, Vector<Vector3f, FaceId> )
431
432 ( TexturePerFace, Vector<TextureId, FaceId> )
433 ( VertColors, Vector<Color, VertId> )
434 ( FaceColors, Vector<Color, FaceId> )
435 ( EdgeColors, Vector<Color, EdgeId> )
436 ( UndirectedEdgeColors, Vector<Color, UndirectedEdgeId> )
437
438 ( VertScalars, Vector<float, VertId> )
439 ( FaceScalars, Vector<float, FaceId> )
440 ( EdgeScalars, Vector<float, EdgeId> )
441 ( UndirectedEdgeScalars, Vector<float, UndirectedEdgeId> )
442)
443
444using VertPredicate = std::function<bool( VertId )>;
445using FacePredicate = std::function<bool( FaceId )>;
446using EdgePredicate = std::function<bool( EdgeId )>;
447using UndirectedEdgePredicate = std::function<bool( UndirectedEdgeId )>;
448
449using PreCollapseCallback = std::function<bool( EdgeId edgeToCollapse, const Vector3f& newEdgeOrgPos )>;
450using OnEdgeSplit = std::function<void( EdgeId e1, EdgeId e )>;
451
452template <typename T>
453[[nodiscard]] inline bool contains( const std::function<bool( Id<T> )> & pred, Id<T> id )
454{
455 return id.valid() && ( !pred || pred( id ) );
456}
457
458using VertMetric = std::function<float( VertId )>;
459using FaceMetric = std::function<float( FaceId )>;
460using EdgeMetric = std::function<float( EdgeId )>;
461using UndirectedEdgeMetric = std::function<float( UndirectedEdgeId )>;
462
463MR_CANONICAL_TYPEDEFS( (template <typename T, typename I> struct MRMESH_CLASS), BMap,
464 ( FaceBMap, BMap<FaceId, FaceId> )
465 ( VertBMap, BMap<VertId, VertId> )
466 ( EdgeBMap, BMap<EdgeId, EdgeId> )
467 ( UndirectedEdgeBMap, BMap<UndirectedEdgeId, UndirectedEdgeId> )
468 ( WholeEdgeBMap, BMap<EdgeId, UndirectedEdgeId> )
469)
470
471template <typename T, typename Hash = phmap::priv::hash_default_hash<T>, typename Eq = phmap::priv::hash_default_eq<T>>
472using HashSet = phmap::flat_hash_set<T, Hash, Eq>;
473template <typename T, typename Hash = phmap::priv::hash_default_hash<T>, typename Eq = phmap::priv::hash_default_eq<T>>
474using ParallelHashSet = phmap::parallel_flat_hash_set<T, Hash, Eq>;
475
476// No canonical typedefs because `phmap::...` is not under our control.
477using FaceHashSet = HashSet<FaceId>;
478using VertHashSet = HashSet<VertId>;
479using EdgeHashSet = HashSet<EdgeId>;
480
481template <typename K, typename V, typename Hash = phmap::priv::hash_default_hash<K>, typename Eq = phmap::priv::hash_default_eq<K>>
482using HashMap = phmap::flat_hash_map<K, V, Hash, Eq>;
483template <typename K, typename V, typename Hash = phmap::priv::hash_default_hash<K>, typename Eq = phmap::priv::hash_default_eq<K>>
484using ParallelHashMap = phmap::parallel_flat_hash_map<K, V, Hash, Eq>;
485
486using FaceHashMap = HashMap<FaceId, FaceId>;
487using VertHashMap = HashMap<VertId, VertId>;
488using EdgeHashMap = HashMap<EdgeId, EdgeId>;
489using UndirectedEdgeHashMap = HashMap<UndirectedEdgeId, UndirectedEdgeId>;
491using WholeEdgeHashMap = HashMap<UndirectedEdgeId, EdgeId>;
492
493template <typename I> class UnionFind;
494template <typename T, typename I, typename P> class Heap;
495
505struct MeshOrPointsXf;
506struct MeshTexture;
507struct GridSettings;
508struct TriMesh;
509
510MR_CANONICAL_TYPEDEFS( ( template <typename T> struct ), MRMESH_CLASS MeshRegion,
511 ( MeshPart, MeshRegion<FaceTag> )
512 ( MeshVertPart, MeshRegion<VertTag> )
513)
514
515template<typename T> class UniqueThreadSafeOwner;
516
517class PolylineTopology;
518
519MR_CANONICAL_TYPEDEFS( (template<typename V> struct), Polyline,
520 ( Polyline2, Polyline<Vector2f> )
521 ( Polyline3, Polyline<Vector3f> )
522)
523
526 ( AABBTreePolyline3, AABBTreePolyline<Vector3f> )
527)
528
529template<typename T> struct IntersectionPrecomputes;
530template<typename T> struct IntersectionPrecomputes2;
531
532MR_CANONICAL_TYPEDEFS( (template<typename V> struct [[nodiscard]]), PolylineProjectionResult,
533 ( PolylineProjectionResult2, PolylineProjectionResult<Vector2f> )
534 ( PolylineProjectionResult3, PolylineProjectionResult<Vector3f> )
535)
536
537MR_CANONICAL_TYPEDEFS( (template<typename V> struct [[nodiscard]]), PolylineProjectionWithOffsetResult,
539 ( PolylineProjectionWithOffsetResult3, PolylineProjectionWithOffsetResult<Vector3f> )
540)
541
542class DistanceMap;
543
544using GcodeSource = std::vector<std::string>;
545
546class Object;
547class SceneRootObject;
548class VisualObject;
549class ObjectMeshHolder;
550class ObjectMesh;
552class ObjectPoints;
554class ObjectLines;
556class ObjectLabel;
557class ObjectGcode;
558class PointObject;
559class LineObject;
560class CircleObject;
561class PlaneObject;
562class SphereObject;
563class CylinderObject;
564class ConeObject;
565
566struct LoadedObjects;
567
568struct Image;
570
571class HistoryAction;
578class ChangeMeshAction;
581class ChangeXfAction;
583class SwapRootAction;
584
585MR_CANONICAL_TYPEDEFS( (template <typename Tag> class MRMESH_CLASS), ColorMapAggregator,
586 ( VertColorMapAggregator, ColorMapAggregator<VertTag> )
587 ( UndirEdgeColorMapAggregator, ColorMapAggregator<UndirectedEdgeTag> )
588 ( FaceColorMapAggregator, ColorMapAggregator<FaceTag> )
589)
590
591template<typename T>
592class FewSmallest;
593
594class Graph;
595class WatershedGraph;
596
600typedef std::function<bool( float )> ProgressCallback;
601
602enum class FilterType : char
603{
604 Linear,
606};
607
608enum class WrapType : char
609{
610 Repeat,
611 Mirror,
612 Clamp
613};
614
616enum class Reorder : char
617{
618 None,
620 AABBTree
621};
622
623template <typename T>
624constexpr inline T sqr( T x ) noexcept { return x * x; }
625
626template <typename T>
627constexpr inline int sgn( T x ) noexcept { return x > 0 ? 1 : ( x < 0 ? -1 : 0 ); }
628
629template<typename...>
630inline constexpr bool dependent_false = false;
631
632template<class... Ts>
633struct overloaded : Ts... { using Ts::operator()...; };
634
635// explicit deduction guide (not needed as of C++20, but still needed in Clang)
636template<class... Ts>
637overloaded(Ts...) -> overloaded<Ts...>;
638
641
642namespace MeshBuilder
643{
644
645struct BuildSettings;
646struct Triangle;
647struct VertDuplication;
648
649} //namespace MeshBuilder
650
651} //namespace MR
652
653#ifdef __cpp_lib_unreachable
654# define MR_UNREACHABLE std::unreachable();
655# define MR_UNREACHABLE_NO_RETURN std::unreachable();
656#else
657# ifdef __GNUC__
658# define MR_UNREACHABLE __builtin_unreachable();
659# define MR_UNREACHABLE_NO_RETURN __builtin_unreachable();
660# else
661# define MR_UNREACHABLE { assert( false ); return {}; }
662# define MR_UNREACHABLE_NO_RETURN assert( false );
663# endif
664#endif
#define MR_CANONICAL_TYPEDEFS(type_, name_, aliases_)
Definition MRCanonicalTypedefs.h:23
#define MRMESH_CLASS
Definition MRMesh/MRMeshFwd.h:72
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:67
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:165
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 MRCone3.h:11
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:494
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, computes the closest point on mesh to each of given points. Pure virtual functions mu...
Definition MRPointsToMeshProjector.h:12
Definition MRMesh/MRId.h:13
Definition MRLaplacian.h:32
Definition MRLineObject.h:12
Definition MRMesh/MRMeshOrPoints.h:17
Definition MRMesh/MRMeshTopology.h:18
Definition MRObjectDistanceMap.h:13
Definition MRObjectGcode.h:14
Definition MRObjectLabel.h:25
Definition MRObjectLinesHolder.h:19
Definition MRObjectLines.h:11
Definition MRObjectMeshHolder.h:30
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 MRPointToPlaneAligningTransform.h:20
Definition MRPointToPointAligningTransform.h:16
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:240
Definition MRSphereObject.h:15
Definition MRSwapRootAction.h:13
container of bits representing specific indices (faces, verts or edges)
Definition MRMesh/MRBitSet.h:127
Simple union find data structure.
Definition MRUnionFind.h:16
Definition MRUniqueThreadSafeOwner.h:20
std::vector<T>-like container that requires specific indexing type,
Definition MRMesh/MRVector.h:20
Definition MRViewportId.h:16
stores mask of viewport unique identifiers
Definition MRViewportId.h:38
Visual Object.
Definition MRVisualObject.h:131
graphs representing rain basins on the mesh
Definition MRWatershedGraph.h:12
bool contains(const TaggedBitSet< T > *bitset, Id< T > id)
Definition MRMesh/MRBitSet.h:226
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:600
@ None
special value not to limit path in one slice
Definition MRVoxelPath.h:33
std::function< float(VertId)> VertMetric
Definition MRMesh/MRMeshFwd.h:458
phmap::parallel_flat_hash_map< K, V, Hash, Eq > ParallelHashMap
Definition MRMesh/MRMeshFwd.h:484
std::vector< EdgeId > EdgeLoop
Definition MRMesh/MRMeshFwd.h:121
std::vector< std::string > GcodeSource
Definition MRMesh/MRMeshFwd.h:544
WrapType
Definition MRMesh/MRMeshFwd.h:609
std::vector< SurfacePath > SurfacePaths
Definition MRMesh/MRMeshFwd.h:373
std::vector< EdgeLoop > EdgeLoops
Definition MRMesh/MRMeshFwd.h:122
class MRMESH_CLASS UndirectedEdgeTag
Definition MRMesh/MRMeshFwd.h:83
constexpr T sqr(T x) noexcept
Definition MRMesh/MRMeshFwd.h:624
Cylinder3f
Definition MRMesh/MRMeshFwd.h:283
AABBTreePolyline2
Definition MRMesh/MRMeshFwd.h:525
Contour3< double > Contour3d
Definition MRMesh/MRMeshFwd.h:298
class MRMESH_CLASS ObjTag
Definition MRMesh/MRMeshFwd.h:90
Eq
Definition MRMesh/MRMeshFwd.h:471
std::function< bool(FaceId)> FacePredicate
Definition MRMesh/MRMeshFwd.h:445
MinMax< float > MinMaxf
Definition MRMesh/MRMeshFwd.h:335
Contour2< double > Contour2d
Definition MRMesh/MRMeshFwd.h:296
class MRMESH_CLASS NodeTag
Definition MRMesh/MRMeshFwd.h:89
HashSet< VertId > VertHashSet
Definition MRMesh/MRMeshFwd.h:478
std::function< bool(EdgeId)> EdgePredicate
Definition MRMesh/MRMeshFwd.h:446
Hash
Definition MRMesh/MRMeshFwd.h:471
Contour2< float > Contour2f
Definition MRMesh/MRMeshFwd.h:297
Contours2< double > Contours2d
Definition MRMesh/MRMeshFwd.h:304
std::function< bool(UndirectedEdgeId)> UndirectedEdgePredicate
Definition MRMesh/MRMeshFwd.h:447
SurfacePaths PlaneSections
Definition MRMesh/MRMeshFwd.h:377
HashMap< VertId, VertId > VertHashMap
Definition MRMesh/MRMeshFwd.h:487
class MRMESH_CLASS VoxelTag
Definition MRMesh/MRMeshFwd.h:87
FilterType
Definition MRMesh/MRMeshFwd.h:603
SurfacePath IsoLine
Definition MRMesh/MRMeshFwd.h:374
Vector2f UVCoord
Definition MRMesh/MRMeshFwd.h:402
Triangle3< int > Triangle3i
Definition MRMesh/MRMeshFwd.h:358
MRMESH_CLASS Vector3b
Definition MRMesh/MRMeshFwd.h:160
std::vector< MeshEdgePoint > SurfacePath
Definition MRMesh/MRMeshFwd.h:372
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:491
class MRMESH_CLASS FaceTag
Definition MRMesh/MRMeshFwd.h:84
class MRMESH_CLASS TextureTag
Definition MRMesh/MRMeshFwd.h:91
class MRMESH_CLASS PixelTag
Definition MRMesh/MRMeshFwd.h:86
Contours< Vector2< T > > Contours2
Definition MRMesh/MRMeshFwd.h:302
MRMESH_CLASS Vector3< double > Matrix2< double > Matrix4< double > SymMatrix3< double > AffineXf2f
Definition MRMesh/MRMeshFwd.h:224
SetBitIterator
Definition MRMesh/MRMeshFwd.h:142
overloaded(Ts...) -> overloaded< Ts... >
MRMESH_CLASS Vector3< double > Matrix2< double > Matrix4b
Definition MRMesh/MRMeshFwd.h:192
constexpr int sgn(T x) noexcept
Definition MRMesh/MRMeshFwd.h:627
Contours2< float > Contours2f
Definition MRMesh/MRMeshFwd.h:305
RigidScaleXf3f
Definition MRMesh/MRMeshFwd.h:238
std::function< float(EdgeId)> EdgeMetric
Definition MRMesh/MRMeshFwd.h:460
MinMax< double > MinMaxd
Definition MRMesh/MRMeshFwd.h:336
std::function< bool(EdgeId edgeToCollapse, const Vector3f &newEdgeOrgPos)> PreCollapseCallback
Definition MRMesh/MRMeshFwd.h:449
Contour< Vector2< T > > Contour2
Definition MRMesh/MRMeshFwd.h:294
SurfacePath PlaneSection
Definition MRMesh/MRMeshFwd.h:376
HashMap< FaceId, FaceId > FaceHashMap
Definition MRMesh/MRMeshFwd.h:486
std::function< float(FaceId)> FaceMetric
Definition MRMesh/MRMeshFwd.h:459
Triangle3< double > Triangle3d
Definition MRMesh/MRMeshFwd.h:360
Box1i
Definition MRMesh/MRMeshFwd.h:321
Contour< Vector3< T > > Contour3
Definition MRMesh/MRMeshFwd.h:295
HashSet< FaceId > FaceHashSet
Definition MRMesh/MRMeshFwd.h:477
std::vector< EdgeId > EdgePath
Definition MRMesh/MRMeshFwd.h:120
std::array< VertId, 3 > ThreeVertIds
three vertex ids describing a triangle topology
Definition MRMesh/MRMeshFwd.h:405
class MRMESH_CLASS VertTag
Definition MRMesh/MRMeshFwd.h:85
std::pair< FaceId, FaceId > FacePair
Definition MRMesh/MRMeshFwd.h:382
constexpr NoInit noInit
Definition MRMesh/MRMeshFwd.h:79
HashSet< EdgeId > EdgeHashSet
Definition MRMesh/MRMeshFwd.h:479
std::pair< UndirectedEdgeId, UndirectedEdgeId > UndirectedEdgePair
Definition MRMesh/MRMeshFwd.h:384
Cone3f
Definition MRMesh/MRMeshFwd.h:288
BestFitParabolaf
Definition MRMesh/MRMeshFwd.h:278
I
Definition MRMesh/MRMeshFwd.h:110
std::pair< EdgeId, EdgeId > EdgePair
Definition MRMesh/MRMeshFwd.h:383
std::function< void(EdgeId e1, EdgeId e)> OnEdgeSplit
Definition MRMesh/MRMeshFwd.h:450
std::function< float(UndirectedEdgeId)> UndirectedEdgeMetric
Definition MRMesh/MRMeshFwd.h:461
constexpr bool dependent_false
Definition MRMesh/MRMeshFwd.h:630
Triangle3< float > Triangle3f
Definition MRMesh/MRMeshFwd.h:359
SurfacePaths IsoLines
Definition MRMesh/MRMeshFwd.h:375
class MRMESH_CLASS EdgeTag
Definition MRMesh/MRMeshFwd.h:82
Contours3< float > Contours3f
Definition MRMesh/MRMeshFwd.h:307
std::vector< Contour< V > > Contours
Definition MRMesh/MRMeshFwd.h:301
Polyline2ProjectionWithOffsetResult
Definition MRMesh/MRMeshFwd.h:538
HashMap< EdgeId, EdgeId > EdgeHashMap
Definition MRMesh/MRMeshFwd.h:488
phmap::parallel_flat_hash_set< T, Hash, Eq > ParallelHashSet
Definition MRMesh/MRMeshFwd.h:474
MRMESH_CLASS Vector3< double > Matrix2b
Definition MRMesh/MRMeshFwd.h:176
std::pair< VertId, VertId > VertPair
Definition MRMesh/MRMeshFwd.h:381
Contour3< float > Contour3f
Definition MRMesh/MRMeshFwd.h:299
HashMap< UndirectedEdgeId, UndirectedEdgeId > UndirectedEdgeHashMap
Definition MRMesh/MRMeshFwd.h:489
Contours< Vector3< T > > Contours3
Definition MRMesh/MRMeshFwd.h:303
Contours3< double > Contours3d
Definition MRMesh/MRMeshFwd.h:306
class MRMESH_CLASS RegionTag
Definition MRMesh/MRMeshFwd.h:88
MRMESH_CLASS Vector3< double > Matrix2< double > Matrix4< double > SymMatrix3b
Definition MRMesh/MRMeshFwd.h:208
class MRMESH_CLASS GraphVertTag
Definition MRMesh/MRMeshFwd.h:92
phmap::flat_hash_map< K, V, Hash, Eq > HashMap
Definition MRMesh/MRMeshFwd.h:482
class MRMESH_CLASS GraphEdgeTag
Definition MRMesh/MRMeshFwd.h:93
Reorder
determines how points to be ordered
Definition MRMesh/MRMeshFwd.h:617
@ 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
Box given by its min- and max- corners.
Definition MRMesh/MRBox.h:25
Definition MRCloudPartMapping.h:10
Definition MRMesh/MRColor.h:9
Definition MRDipole.h:11
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 MRImage.h:15
Definition MRMesh/MRMeshFwd.h:530
Definition MRMesh/MRMeshFwd.h:396
Definition MRMesh/MRMeshFwd.h:398
Definition MRLineSegm.h:11
Definition MRLine.h:12
result of loading (e.g. from a file) as a number of objects
Definition MRLoadedObjects.h:28
Definition MRMatrix2.h:13
Definition MRMesh/MRMatrix3.h:13
Definition MRMatrix4.h:14
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:23
Definition MRNoDefInit.h:11
Definition MRMesh/MRMeshFwd.h:78
Definition MRBuffer.h:151
Represents quadratic function f(x) = a*x*x + b*x + c.
Definition MRParabola.h:11
Definition MRPartMapping.h:10
Definition MRPlane3.h:12
Definition MRMesh/MRPointCloud.h:16
Definition MRMesh/MRPointOnFace.h:11
Definition MRPointOnObject.h:16
Definition MRPolylineProject.h:15
Definition MRPolylineProject.h:53
Definition MRPolyline.h:18
Definition MRQuadraticForm.h:13
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
describes a number of local triangulations of some points (e.g. assigned to a thread)
Definition MRLocalTriangulations.h:40
Definition MRSphere.h:9
Definition MRSymMatrix2.h:14
Definition MRSymMatrix3.h:15
Definition MRSymMatrix4.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:18
Definition MRMesh/MRVector3.h:19
Definition MRVector4.h:13
Definition MRMesh/MRMeshFwd.h:633