MeshLib Documentation
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 std::function<Primitives::Variant()> create;
21};
22
23// A user callback for `forEachSubfeature()`.
24using SubfeatureFunc = std::function<void( const SubfeatureInfo& info )>;
25
26// Decomposes a feature to its subfeatures, by calling `func()` on each subfeature.
27// This only returns the direct subfeatures. You can call this recursively to obtain all features,
28// but beware of duplicates (there's no easy way to filter them).
30
31}
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
std::variant< Sphere, ConeSegment, Plane > Variant
Definition MRFeatures.h:111
Definition MRFeatures.h:21
std::function< void(const SubfeatureInfo &info)> SubfeatureFunc
Definition MRSubfeatures.h:24
MRMESH_API void forEachSubfeature(const Features::Primitives::Variant &feature, const SubfeatureFunc &func)
Definition MRSubfeatures.h:12
std::string_view name
Definition MRSubfeatures.h:14
std::function< Primitives::Variant()> create
Definition MRSubfeatures.h:20
bool isInfinite
Definition MRSubfeatures.h:17