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

Function offsetPolyline

source/MRVoxels/MROffset.cpp:386–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384}
385
386Expected<Mesh> offsetPolyline( const Polyline3& polyline, float offset, const OffsetParameters& params /*= {} */ )
387{
388 MR_TIMER;
389
390 Mesh mesh;
391 auto contours = polyline.topology.convertToContours<Vector3f>(
392 [&points = polyline.points]( VertId v )
393 {
394 return points[v];
395 } );
396
397 std::vector<EdgeId> newHoles;
398 newHoles.reserve( contours.size() );
399 for ( auto& cont : contours )
400 {
401 if ( cont[0] != cont.back() )
402 cont.insert( cont.end(), cont.rbegin(), cont.rend() );
403 newHoles.push_back( mesh.addSeparateEdgeLoop( cont ) );
404 }
405
406 for ( auto h : newHoles )
407 makeDegenerateBandAroundHole( mesh, h );
408
409 // Type::Shell is more efficient in this case
410 OffsetParameters p = params;
411 p.signDetectionMode = SignDetectionMode::Unsigned;
412
413 return offsetMesh( mesh, offset, p );
414}
415
416}

Callers

nothing calls this directly

Calls 8

offsetMeshFunction · 0.85
insertMethod · 0.80
push_backMethod · 0.80
addSeparateEdgeLoopMethod · 0.80
reserveMethod · 0.45
sizeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected