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

Function addBaseToPlanarMesh

source/MRMesh/MRAlignContoursToMesh.cpp:20–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18{
19
20void addBaseToPlanarMesh( Mesh& mesh, float zOffset )
21{
22 MR_TIMER;
23 mesh.pack(); // for some hard fonts with duplicated points (if triangulated contours have same points, duplicates are not used)
24 // it's important to have all vertices valid:
25 // first half is upper points of text and second half is lower points of text
26
27 Mesh mesh2 = mesh;
28 for ( auto& p : mesh2.points )
29 p.z += zOffset;
30
31 mesh2.topology.flipOrientation();
32
33 mesh.addMesh( mesh2 );
34
35 auto edges = mesh.topology.findHoleRepresentiveEdges();
36 for ( int bi = 0; bi < edges.size() / 2; ++bi )
37 {
38 StitchHolesParams stitchParams;
39 stitchParams.metric = getVerticalStitchMetric( mesh, Vector3f::plusZ() );
40 stitchHoles( mesh, edges[bi], edges[edges.size() / 2 + bi], stitchParams );
41 }
42}
43
44Expected<Mesh> alignContoursToMesh( const Mesh& mesh, const Contours2f& contours, const ContoursMeshAlignParams& params )
45{

Callers 3

alignContoursToMeshFunction · 0.85
bendContoursAlongCurveFunction · 0.85
createSymbolsMeshFunction · 0.85

Calls 7

getVerticalStitchMetricFunction · 0.85
stitchHolesFunction · 0.85
addMeshMethod · 0.80
packMethod · 0.45
flipOrientationMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected