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

Function cloneRegion

source/MRMesh/MRObjectLines.cpp:158–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158std::shared_ptr<ObjectLines> cloneRegion( const std::shared_ptr<ObjectLines>& objLines, const UndirectedEdgeBitSet& region )
159{
160 MR_TIMER;
161 std::shared_ptr<Polyline3> newPolyline = std::make_shared<Polyline3>();
162 VertMap src2clone;
163 newPolyline->addPartByMask( *objLines->polyline(), region, &src2clone );
164 std::shared_ptr<ObjectLines> newObj = std::make_shared<ObjectLines>();
165 newObj->setFrontColor( objLines->getFrontColor( true ), true );
166 newObj->setFrontColor( objLines->getFrontColor( false ), false );
167 newObj->setBackColor( objLines->getBackColor() );
168 newObj->setPolyline( newPolyline );
169 newObj->setAllVisualizeProperties( objLines->getAllVisualizeProperties() );
170
171 VertMap clone2src;
172 clone2src.resizeNoInit( newPolyline->points.size() );
173 ParallelFor( src2clone, [&] ( VertId srcV )
174 {
175 if( auto cloneV = src2clone[srcV] )
176 clone2src[cloneV] = srcV;
177 } );
178 newObj->copyColors( *objLines, clone2src );
179 newObj->setName( objLines->name() + "_part" );
180 return newObj;
181}
182
183} // namespace MR

Callers

nothing calls this directly

Calls 9

ParallelForFunction · 0.85
setBackColorMethod · 0.80
setPolylineMethod · 0.80
addPartByMaskMethod · 0.45
setFrontColorMethod · 0.45
sizeMethod · 0.45
copyColorsMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected