| 795 | } |
| 796 | |
| 797 | void TriContourGenerator::find_interior_lines(Contour& contour, |
| 798 | const double& level, |
| 799 | bool on_upper, |
| 800 | bool filled) |
| 801 | { |
| 802 | const Triangulation& triang = _triangulation; |
| 803 | int ntri = triang.get_ntri(); |
| 804 | for (int tri = 0; tri < ntri; ++tri) { |
| 805 | int visited_index = (on_upper ? tri+ntri : tri); |
| 806 | |
| 807 | if (_interior_visited[visited_index] || triang.is_masked(tri)) |
| 808 | continue; // Triangle has already been visited or is masked. |
| 809 | |
| 810 | _interior_visited[visited_index] = true; |
| 811 | |
| 812 | // Determine edge via which to leave this triangle. |
| 813 | int edge = get_exit_edge(tri, level, on_upper); |
| 814 | assert(edge >= -1 && edge < 3 && "Invalid exit edge"); |
| 815 | if (edge == -1) |
| 816 | continue; // Contour does not pass through this triangle. |
| 817 | |
| 818 | // Found start of new contour line loop. |
| 819 | contour.push_back(ContourLine()); |
| 820 | ContourLine& contour_line = contour.back(); |
| 821 | TriEdge tri_edge = triang.get_neighbor_edge(tri, edge); |
| 822 | follow_interior(contour_line, tri_edge, false, level, on_upper); |
| 823 | |
| 824 | if (!filled) |
| 825 | // Non-filled contour lines must be closed. |
| 826 | contour_line.push_back(contour_line.front()); |
| 827 | else if (contour_line.size() > 1 && |
| 828 | contour_line.front() == contour_line.back()) |
| 829 | // Filled contour lines must not have same first and last points. |
| 830 | contour_line.pop_back(); |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | bool TriContourGenerator::follow_boundary(ContourLine& contour_line, |
| 835 | TriEdge& tri_edge, |
nothing calls this directly
no test coverage detected