[gtk/path-ops: 1/4] Add an outline of the algorithm




commit 972f6830f7735b45f22e6d33ad620ee19c5ac653
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Mar 25 10:06:28 2022 -0400

    Add an outline of the algorithm

 gsk/gskpathsimplify.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/gsk/gskpathsimplify.c b/gsk/gskpathsimplify.c
index b79af4cca7..e86a4a8c66 100644
--- a/gsk/gskpathsimplify.c
+++ b/gsk/gskpathsimplify.c
@@ -551,6 +551,20 @@ compare_angle (gconstpointer p1,
   return f1 < f2 ? -1 : (f1 > f2 ? 1 : 0);
 }
 
+/*
+ * The general plan of operation is as follows:
+ * - Collect all the segments in a list
+ * - Add all segment-segment intersections, splitting the segments
+ *   as needed, and keep Connection structs that recorder which
+ *   segements are meeting at which intersections
+ * - Classify each segment as boundary or not. This is where
+ *   the different boolean ops differ from each other
+ * - Sort the edges at each connection, counterclockwise
+ * - Walk the edge-connection graph, taking the proper turns at
+ *   each connection, to reassemble contours
+ * - Continue doing so until all boundary segments have been
+ *   added to a contour
+ */
 static GskPath *
 gsk_path_op (PathOp   operation,
              GskPath *self,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]