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

Method init

source/MRMesh/MRRadiusCompensation.cpp:78–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76};
77
78Expected<void> RadiusCompensator::init()
79{
80 MR_TIMER;
81 const auto& faceRegion = &mesh_.topology.getFaceIds( params_.region );
82 assert( faceRegion );
83 vertRegion_ = getInnerVerts( mesh_.topology, *faceRegion );
84 auto vertRegionWithBounds = getIncidentVerts( mesh_.topology, *faceRegion );
85
86 if ( MeshComponents::hasFullySelectedComponent( mesh_, vertRegion_ - mesh_.topology.findBdVerts( nullptr, &vertRegion_ ) ) )
87 return unexpected( "MeshPart should not contain closed components" );
88
89 auto [xvec, yvec] = params_.direction.perpendicular();
90 toWorldXf_ = AffineXf3f::linear( Matrix3f::fromColumns( xvec, yvec, params_.direction ) );
91 toPlaneXf_ = toWorldXf_.inverse();
92
93 planeVerts_.resize( vertRegionWithBounds.size() );
94 bool keepGoing = BitSetParallelFor( vertRegionWithBounds, [&] ( VertId v )
95 {
96 planeVerts_[v] = to3dim( to2dim( toPlaneXf_( mesh_.points[v] ) ) );
97 }, subprogress( params_.callback, 0.0f, 0.1f ) );
98
99 if ( !keepGoing )
100 return unexpectedOperationCanceled();
101
102 planeTree_ = std::make_unique<AABBTreePoints>( planeVerts_, vertRegionWithBounds );
103 return {};
104}
105
106Expected<void> RadiusCompensator::calcCompensations()
107{

Callers 1

compensateRadiusFunction · 0.45

Calls 13

getInnerVertsFunction · 0.85
getIncidentVertsFunction · 0.85
BitSetParallelForFunction · 0.85
to3dimFunction · 0.85
to2dimFunction · 0.85
subprogressFunction · 0.85
findBdVertsMethod · 0.80
unexpectedFunction · 0.70
inverseMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected