| 1647 | } |
| 1648 | |
| 1649 | Expected<void> interpolateLines( std::vector<GCommand>& commands, const LineInterpolationParams& params, Axis axis ) |
| 1650 | { |
| 1651 | size_t startIndex = 0u; |
| 1652 | |
| 1653 | for ( int i = 0; startIndex < commands.size(); ++i ) |
| 1654 | { |
| 1655 | if ( ( i & 0x3FF ) && !reportProgress( params.cb, float( startIndex ) / commands.size() ) ) |
| 1656 | return unexpectedOperationCanceled(); |
| 1657 | |
| 1658 | while ( startIndex != commands.size() && ( commands[startIndex].type != MoveType::Linear || std::isnan( coord( commands[startIndex], axis ) ) ) ) |
| 1659 | ++startIndex; |
| 1660 | |
| 1661 | if ( ++startIndex >= commands.size() ) |
| 1662 | return {}; |
| 1663 | |
| 1664 | auto endIndex = startIndex + 1; |
| 1665 | while ( endIndex != commands.size() && std::isnan( coord( commands[endIndex], axis ) ) && commands[endIndex].type == MoveType::Linear ) |
| 1666 | ++endIndex; |
| 1667 | |
| 1668 | const size_t segmentSize = endIndex - startIndex; |
| 1669 | const auto interpolatedSegment = replaceStraightSegmentsWithOneLine( std::span<GCommand>( &commands[startIndex], segmentSize ), params.eps, params.maxLength, axis ); |
| 1670 | if ( interpolatedSegment.empty() ) |
| 1671 | { |
| 1672 | startIndex = endIndex; |
| 1673 | continue; |
| 1674 | } |
| 1675 | |
| 1676 | if ( interpolatedSegment.size() != segmentSize ) |
| 1677 | { |
| 1678 | commands.erase( commands.begin() + startIndex + 1, commands.begin() + endIndex ); |
| 1679 | commands.insert( commands.begin() + startIndex + 1, interpolatedSegment.begin(), interpolatedSegment.end() ); |
| 1680 | } |
| 1681 | |
| 1682 | startIndex = startIndex + interpolatedSegment.size() + 1; |
| 1683 | } |
| 1684 | |
| 1685 | if ( !reportProgress( params.cb, 1.0f ) ) |
| 1686 | return unexpectedOperationCanceled(); |
| 1687 | |
| 1688 | return {}; |
| 1689 | } |
| 1690 | |
| 1691 | FaceBitSet smoothSelection( Mesh& mesh, const FaceBitSet& region, float expandOffset, float shrinkOffset ) |
| 1692 | { |
nothing calls this directly
no test coverage detected