MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / start_filled

Method start_filled

source/matplot/util/contourc.cpp:1772–1822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1770 }
1771
1772 ContourLine *QuadContourGenerator::start_filled(
1773 long quad, Edge edge, unsigned int start_level_index,
1774 HoleOrNot hole_or_not, BoundaryOrInterior boundary_or_interior,
1775 const double &lower_level, const double &upper_level) {
1776 assert(quad >= 0 && quad < _n && "Quad index out of bounds");
1777 assert(edge != Edge::Edge_None && "Invalid edge");
1778 assert((start_level_index == 1 || start_level_index == 2) &&
1779 "start level index must be 1 or 2");
1780
1781 ContourLine *contour_line =
1782 new ContourLine(hole_or_not == HoleOrNot::Hole);
1783 if (hole_or_not == HoleOrNot::Hole) {
1784 // Find and set parent ContourLine.
1785 ContourLine *parent = _parent_cache.get_parent(quad + 1);
1786 assert(parent != 0 && "Failed to find parent ContourLine");
1787 contour_line->set_parent(parent);
1788 parent->add_child(contour_line);
1789 }
1790
1791 QuadEdge quad_edge(quad, edge);
1792 const QuadEdge start_quad_edge(quad_edge);
1793 unsigned int level_index = start_level_index;
1794
1795 // If starts on interior, can only finish on interior.
1796 // If starts on boundary, can only finish on boundary.
1797
1798 while (true) {
1799 if (boundary_or_interior == BoundaryOrInterior::Interior) {
1800 double level = (level_index == 1 ? lower_level : upper_level);
1801 follow_interior(*contour_line, quad_edge, level_index, level,
1802 false, &start_quad_edge, start_level_index,
1803 true);
1804 } else {
1805 level_index =
1806 follow_boundary(*contour_line, quad_edge, lower_level,
1807 upper_level, level_index, start_quad_edge);
1808 }
1809
1810 if (quad_edge == start_quad_edge &&
1811 (boundary_or_interior == BoundaryOrInterior::Boundary ||
1812 level_index == start_level_index))
1813 break;
1814
1815 if (boundary_or_interior == BoundaryOrInterior::Boundary)
1816 boundary_or_interior = BoundaryOrInterior::Interior;
1817 else
1818 boundary_or_interior = BoundaryOrInterior::Boundary;
1819 }
1820
1821 return contour_line;
1822 }
1823
1824 bool QuadContourGenerator::start_line(vertices_list_type &vertices_list,
1825 long quad, Edge edge,

Callers

nothing calls this directly

Calls 3

get_parentMethod · 0.80
set_parentMethod · 0.80
add_childMethod · 0.80

Tested by

no test coverage detected