MeshLib C++ Docs
Loading...
Searching...
No Matches
MRSubfeatures.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMesh/MRFeatures.h"
4
5#include <functional>
6
7namespace MR::Features
8{
9
10// Describes a single feature produced by `forEachSubfeature()`.
12{
13 // A user-friendly name.
14 std::string_view name;
15
16 // Whether the feature has infinite length.
17 bool isInfinite = false;
18
19 // Call this to create this subfeature.
20 // Pass the same feature you passed to `forEachSubfeature()`, or a DIFFERENT one to create the same kind of subfeature relative to that.
22};
23
24// A user callback for `forEachSubfeature()`.
25using SubfeatureFunc = std::function<void( const SubfeatureInfo& info )>;
26
27// Decomposes a feature to its subfeatures, by calling `func()` on each subfeature.
28// This only returns the direct subfeatures. You can call this recursively to obtain all features,
29// but beware of duplicates (there's no easy way to filter them).
31
32}
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:68
std::variant< Sphere, ConeSegment, Plane > Variant
Definition MRFeatures.h:113
Definition MRFeatures.h:22
std::function< void(const SubfeatureInfo &info)> SubfeatureFunc
Definition MRSubfeatures.h:25
MRMESH_API void forEachSubfeature(const Features::Primitives::Variant &feature, const SubfeatureFunc &func)
Definition MRSubfeatures.h:12
std::function< Primitives::Variant(const Features::Primitives::Variant &feature)> create
Definition MRSubfeatures.h:21
std::string_view name
Definition MRSubfeatures.h:14
bool isInfinite
Definition MRSubfeatures.h:17