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

Function addSurfacePath

source/MRVoxels/MRToolPath.cpp:116–142  ·  view source on GitHub ↗

compute surface path between given edge points

Source from the content-addressed store, hash-verified

114
115// compute surface path between given edge points
116void addSurfacePath( std::vector<GCommand>& gcode, const Mesh& mesh, const MeshEdgePoint& start, const MeshEdgePoint& end )
117{
118 const auto sp = computeSurfacePath( mesh, start, end );
119 if ( !sp.has_value() || sp->empty() )
120 {
121 const auto p = mesh.edgePoint( end );
122 gcode.push_back( { .x = p.x, .y = p.y, .z = p.z } );
123 return;
124 }
125
126 if ( sp->size() == 1 )
127 {
128 const auto p = mesh.edgePoint( sp->front() );
129 gcode.push_back( { .x = p.x, .y = p.y, .z = p.z } );
130 }
131 else
132 {
133 Polyline3 transit;
134 transit.addFromSurfacePath( mesh, *sp );
135 const auto transitContours = transit.contours().front();
136 for ( const auto& p : transitContours )
137 gcode.push_back( { .x = p.x, .y = p.y, .z = p.z } );
138 }
139
140 const auto p = mesh.edgePoint( end );
141 gcode.push_back( { .x = p.x, .y = p.y, .z = p.z } );
142}
143
144// computes all sections of modified mesh along the given axis
145// if a selected area is specified in the original mesh, then only points projected on it will be taken into consideration

Callers 1

lacingToolPathFunction · 0.85

Calls 7

computeSurfacePathFunction · 0.85
push_backMethod · 0.80
addFromSurfacePathMethod · 0.80
contoursMethod · 0.80
emptyMethod · 0.45
edgePointMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected