[Bf-blender-cvs] [402b0aa59b] master: Comments: notes on polyfill2d, minor corrections

Campbell Barton noreply at git.blender.org
Wed Feb 15 05:09:03 CET 2017


Commit: 402b0aa59b2402a0fb72e5c64949a5480913a492
Author: Campbell Barton
Date:   Wed Feb 15 14:10:42 2017 +1100
Branches: master
https://developer.blender.org/rB402b0aa59b2402a0fb72e5c64949a5480913a492

Comments: notes on polyfill2d, minor corrections

===================================================================

M	source/blender/blenkernel/intern/appdir.c
M	source/blender/blenlib/intern/polyfill2d.c
M	source/blender/blenloader/intern/writefile.c

===================================================================

diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index b1dcc40279..9236a1b585 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -121,7 +121,7 @@ static bool test_path(char *targetpath, const char *path_base, const char *path_
 	if (path_sep) BLI_join_dirfile(tmppath, sizeof(tmppath), path_base, path_sep);
 	else BLI_strncpy(tmppath, path_base, sizeof(tmppath));
 
-	/* rare cases folder_name is omitted (when looking for ~/.blender/2.xx dir only) */
+	/* rare cases folder_name is omitted (when looking for ~/.config/blender/2.xx dir only) */
 	if (folder_name)
 		BLI_make_file_string("/", targetpath, tmppath, folder_name);
 	else
diff --git a/source/blender/blenlib/intern/polyfill2d.c b/source/blender/blenlib/intern/polyfill2d.c
index 8d9881e453..2969b0eccf 100644
--- a/source/blender/blenlib/intern/polyfill2d.c
+++ b/source/blender/blenlib/intern/polyfill2d.c
@@ -21,8 +21,15 @@
 /** \file blender/blenlib/intern/polyfill2d.c
  *  \ingroup bli
  *
- * A simple implementation of the ear cutting algorithm
- * to triangulate simple polygons without holes.
+ * An ear clipping algorithm to triangulate single boundary polygons.
+ *
+ * Details:
+ *
+ * - The algorithm guarantees all triangles are assigned (number of coords - 2)
+ *   and that triangles will have non-overlapping indices (even for degenerate geometry).
+ * - Self-intersections are considered degenerate (resulting triangles will overlap).
+ * - While multiple polygons aren't supported, holes can still be defined using *key-holes*
+ *   (where the polygon doubles back on its self with *exactly* matching coordinates).
  *
  * \note
  *
@@ -74,6 +81,12 @@ typedef signed char eSign;
 
 #ifdef USE_KDTREE
 /**
+ * Spatial optimization for point-in-triangle intersection checks.
+ * The simple version of this algorithm is ``O(n^2)`` complexity
+ * (every point needing to check the triangle defined by every other point),
+ * Using a binary-tree reduces the complexity to ``O(n log n)``
+ * plus some overhead of creating the tree.
+ *
  * This is a single purpose KDTree based on BLI_kdtree with some modifications
  * to better suit polyfill2d.
  *
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index f467010f08..998d4161c2 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -78,7 +78,7 @@
  * - write #TEST (#RenderInfo struct. 128x128 blend file preview is optional).
  * - write #GLOB (#FileGlobal struct) (some global vars).
  * - write #DNA1 (#SDNA struct)
- * - write #USER (#UserDef struct) if filename is ``~/X.XX/config/startup.blend``.
+ * - write #USER (#UserDef struct) if filename is ``~/.config/blender/X.XX/config/startup.blend``.
  */




More information about the Bf-blender-cvs mailing list