MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / forEachVisualSubfeature

Function forEachVisualSubfeature

source/MRViewer/MRVisualSubfeatures.cpp:6–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4{
5
6void forEachVisualSubfeature( const Features::Primitives::Variant& feature, const Features::SubfeatureFunc& func )
7{
8 Features::forEachSubfeature( feature, func );
9
10 // Cap centers.
11 if ( const auto* cone = std::get_if<Features::Primitives::ConeSegment>( &feature ) )
12 {
13 if ( !cone->isCircle() )
14 {
15 for ( bool negativeCap : { false, true } )
16 {
17 float sideLength = negativeCap ? cone->negativeLength : cone->positiveLength;
18 float sideRadius = negativeCap ? cone->negativeSideRadius : cone->positiveSideRadius;
19 float otherSideRadius = negativeCap ? cone->positiveSideRadius : cone->negativeSideRadius;
20 if ( std::isfinite( sideLength ) && sideRadius > 0 )
21 {
22 func( {
23 .name = otherSideRadius <= 0 ? "Base circle center" : negativeCap ? "Base circle center (negative side)" : "Base circle center (positive side)",
24 .isInfinite = false,
25 .create = [negativeCap]( const Features::Primitives::Variant& f ){ return std::get<Features::Primitives::ConeSegment>( f ).basePoint( negativeCap ); },
26 } );
27 }
28 }
29 }
30 }
31}
32
33} // namespace MR::Features

Callers 1

addSubfeaturesFunction · 0.85

Calls 3

forEachSubfeatureFunction · 0.85
isCircleMethod · 0.80
basePointMethod · 0.80

Tested by

no test coverage detected