@@ -386,10 +386,21 @@ void QuadContourGenerator::append_contour_line_to_vertices_and_codes(
386386 PyObject* vertices_list,
387387 PyObject* codes_list) const
388388{
389+ // Convert ContourLine to Python equivalent, and clear it for reuse.
390+ // This function is called once for each line generated in create_contour().
391+ // A line is either a closed line loop (in which case the last point is
392+ // identical to the first) or an open line strip. Two NumPy arrays are
393+ // created for each line:
394+ // vertices is a double array of shape (npoints, 2) containing the (x, y)
395+ // coordinates of the points in the line
396+ // codes is a uint8 array of shape (npoints,) containing the 'kind codes'
397+ // which are defined in the Path class
398+ // and they are appended to the Python lists vertices_list and codes_list
399+ // respectively for return to the Python calling function.
400+
389401 assert (vertices_list != 0 && " Null python vertices_list" );
390402 assert (codes_list != 0 && " Null python codes_list" );
391403
392- // Convert ContourLine to python equivalent, and clear it.
393404 npy_intp npoints = static_cast <npy_intp>(contour_line.size ());
394405
395406 npy_intp vertices_dims[2 ] = {npoints, 2 };
@@ -407,6 +418,7 @@ void QuadContourGenerator::append_contour_line_to_vertices_and_codes(
407418 *codes_ptr++ = (point == contour_line.begin () ? MOVETO : LINETO);
408419 }
409420
421+ // Closed line loop has identical first and last (x, y) points.
410422 if (contour_line.size () > 1 && contour_line.front () == contour_line.back ())
411423 *(codes_ptr-1 ) = CLOSEPOLY;
412424
@@ -425,6 +437,18 @@ void QuadContourGenerator::append_contour_to_vertices_and_codes(
425437 PyObject* vertices_list,
426438 PyObject* codes_list) const
427439{
440+ // Convert Contour to Python equivalent, and clear it for reuse.
441+ // This function is called once for each polygon generated in
442+ // create_filled_contour(). A polygon consists of an outer line loop
443+ // (called the parent) and zero or more inner line loops or holes (called
444+ // the children). Two NumPy arrays are created for each polygon:
445+ // vertices is a double array of shape (npoints, 2) containing the (x, y)
446+ // coordinates of the points in the polygon (parent plus children)
447+ // codes is a uint8 array of shape (npoints,) containing the 'kind codes'
448+ // which are defined in the Path class
449+ // and they are appended to the Python lists vertices_list and codes_list
450+ // respectively for return to the Python calling function.
451+
428452 assert (vertices_list != 0 && " Null python vertices_list" );
429453 assert (codes_list != 0 && " Null python codes_list" );
430454
0 commit comments