[Bf-blender-cvs] [88980d5cdc8] temp-D5423-update: Cleanup: comments, use sentences, some minor spelling corrections

Campbell Barton noreply at git.blender.org
Fri Aug 9 09:13:15 CEST 2019


Commit: 88980d5cdc8e030f4a2cbbe0970b89441570a364
Author: Campbell Barton
Date:   Fri Aug 9 14:24:12 2019 +1000
Branches: temp-D5423-update
https://developer.blender.org/rB88980d5cdc8e030f4a2cbbe0970b89441570a364

Cleanup: comments, use sentences, some minor spelling corrections

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

M	source/blender/blenlib/BLI_delaunay_2d.h
M	source/blender/blenlib/intern/delaunay_2d.c

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

diff --git a/source/blender/blenlib/BLI_delaunay_2d.h b/source/blender/blenlib/BLI_delaunay_2d.h
index f0bfd65788f..77483807793 100644
--- a/source/blender/blenlib/BLI_delaunay_2d.h
+++ b/source/blender/blenlib/BLI_delaunay_2d.h
@@ -31,7 +31,7 @@
  * may be pieced together to form the constraints. Part of the
  * work of doing the CDT is to detect intersections and mergers
  * among the input elements, so these routines are also useful
- * for doing 2d intersection.
+ * for doing 2D intersection.
  *
  * The output is a triangulation of the plane that includes the
  * constraints in the above sense, and also satisfies the
@@ -45,7 +45,7 @@
  *
  * Optionally, the output can be a subset of the triangulation
  * (but still containing all of the constraints), to get the
- * effect of 2d intersection.
+ * effect of 2D intersection.
  *
  * The underlying method is incremental, but we need to know
  * beforehand a bounding box for all of the constraints.
@@ -57,7 +57,7 @@
 /**
  * Input to Constrained Delaunay Triangulation.
  * There are num_vertex vertices, whose coordinates
- * are given by vert_coords. For the rest of tne input,
+ * are given by vert_coords. For the rest of the input,
  * vertices are referred to by indices into that array.
  * Edges and Faces are optional. If provided, they will
  * appear in the output triangulation ("constraints").
@@ -65,10 +65,10 @@
  * implied by the faces will be inferred.
  *
  * The edges are given by pairs of vertex indices.
- * The faces are given in a triple (faces, face_start, face_len)
+ * The faces are given in a triple `(faces, face_start, face_len)`
  * to represent a list-of-lists as follows:
  * the vertex indices for a counterclockwise traversal of
- * face number i starts at face_start[i] and has face_len[i]
+ * face number `i` starts at `face_start[i]` and has `face_len[i]`
  * elements.
  *
  * The edges implied by the faces are automatically added
@@ -91,7 +91,7 @@ typedef struct CDT_input {
 
 /**
  * A representation of the triangulation for output.
- * See CDT_input for the representation of the output
+ * See #CDT_input for the representation of the output
  * vertices, edges, and faces, all represented in
  * a similar way to the input.
  *
diff --git a/source/blender/blenlib/intern/delaunay_2d.c b/source/blender/blenlib/intern/delaunay_2d.c
index b00fd4555b8..41ca5de8723 100644
--- a/source/blender/blenlib/intern/delaunay_2d.c
+++ b/source/blender/blenlib/intern/delaunay_2d.c
@@ -41,31 +41,31 @@ struct CDTEdge;
 struct CDTFace;
 
 typedef struct SymEdge {
-  struct SymEdge *next; /* in face, doing CCW traversal of face */
-  struct SymEdge *rot;  /* CCW around vert */
-  struct CDTVert *vert; /* Vert at origin */
-  struct CDTEdge *edge; /* undirected edge this is for */
-  struct CDTFace *face; /* face on left side */
+  struct SymEdge *next; /* In face, doing CCW traversal of face. */
+  struct SymEdge *rot;  /* CCW around vert. */
+  struct CDTVert *vert; /* Vert at origin. */
+  struct CDTEdge *edge; /* Undirected edge this is for. */
+  struct CDTFace *face; /* Face on left side. */
 } SymEdge;
 
 typedef struct CDTVert {
-  double co[2];        /* coordinates */
-  SymEdge *symedge;    /* some edge attached to it */
-  LinkNode *input_ids; /* list of corresponding vertex input ids */
-  int index;           /* index into array that cdt keeps */
+  double co[2];        /* Coordinate. */
+  SymEdge *symedge;    /* Some edge attached to it. */
+  LinkNode *input_ids; /* List of corresponding vertex input ids. */
+  int index;           /* Index into array that cdt keeps. */
 } CDTVert;
 
 typedef struct CDTEdge {
-  LinkNode *input_ids; /* list of input edge ids that this is part of */
-  SymEdge symedges[2]; /* the directed edges for this edge */
+  LinkNode *input_ids; /* List of input edge ids that this is part of. */
+  SymEdge symedges[2]; /* The directed edges for this edge. */
 } CDTEdge;
 
 typedef struct CDTFace {
-  double centroid[2];  /* average of vertex coords */
-  SymEdge *symedge;    /* a symedge in face; only used during output */
-  LinkNode *input_ids; /* list of input face ids that this is part of */
-  int visit_index;     /* which visit epoch has this been seen */
-  bool deleted;        /* marks this face no longer used */
+  double centroid[2];  /* Average of vertex coords. */
+  SymEdge *symedge;    /* A symedge in face; only used during output. */
+  LinkNode *input_ids; /* List of input face ids that this is part of. */
+  int visit_index;     /* Which visit epoch has this been seen. */
+  bool deleted;        /* Marks this face no longer used. */
 } CDTFace;
 
 typedef struct CDT_state {
@@ -168,8 +168,11 @@ static double closest_to_line_v2_db(double r_close[2],
   return lambda;
 }
 
-/* If intersection == ISECT_LINE_LINE_CROSS or ISECT_LINE_LINE_NONE:
+/**
+ * If intersection == ISECT_LINE_LINE_CROSS or ISECT_LINE_LINE_NONE:
+ * <pre>
  * pt = v1 + lamba * (v2 - v1) = v3 + mu * (v4 - v3)
+ * </pre>
  */
 static int isect_seg_seg_v2_lambda_mu_db(const double v1[2],
                                          const double v2[2],
@@ -201,13 +204,13 @@ static int isect_seg_seg_v2_lambda_mu_db(const double v1[2],
   return ISECT_LINE_LINE_NONE;
 }
 
-/** return 1 if a,b,c forms CCW angle, -1 if a CW angle, 0 if straight */
+/** return 1 if a,b,c forms CCW angle, -1 if a CW angle, 0 if straight  */
 static int CCW_test(const double a[2], const double b[2], const double c[2])
 {
   double det;
   double ab;
 
-  /* this is twice the signed area of triangle abc */
+  /* This is twice the signed area of triangle abc. */
   det = (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]);
   ab = len_v2v2_db(a, b);
   if (ab < DBL_EPSILON)
@@ -220,7 +223,7 @@ static int CCW_test(const double a[2], const double b[2], const double c[2])
   return 0;
 }
 
-/** return true if a -- b -- c are in that order, assuming they are on a straight line */
+/** return true if a -- b -- c are in that order, assuming they are on a straight line. */
 static bool in_line(const double a[2], const double b[2], const double c[2])
 {
   double dir_ab[2], dir_ac[2];
@@ -230,7 +233,7 @@ static bool in_line(const double a[2], const double b[2], const double c[2])
   return dot_v2v2_db(dir_ab, dir_ac) >= 0.0;
 }
 
-/** Is s2 reeachable from s1 by next pointers with < limit hops? */
+/** Is s2 reachable from s1 by next pointers with < limit hops? */
 static bool reachable(SymEdge *s1, SymEdge *s2, int limit)
 {
   int count = 0;
@@ -257,7 +260,7 @@ static void calc_face_centroid(SymEdge *se)
   centroidp[1] /= count;
 }
 
-/** Using array to store these instead of linked list so can make a random selection from them */
+/** Using array to store these instead of linked list so can make a random selection from them. */
 static CDTVert *add_cdtvert(CDT_state *cdt, double x, double y)
 {
   CDTVert *v = BLI_memarena_alloc(cdt->arena, sizeof(*v));
@@ -351,13 +354,13 @@ static void add_list_to_input_ids(LinkNode **dst, const LinkNode *src, CDT_state
   }
 }
 
-/** Return other SymEdge for same CDTEdge as se */
+/** Return other #SymEdge for same #CDTEdge as se. */
 static inline SymEdge *sym(const SymEdge *se)
 {
   return se->next->rot;
 }
 
-/** Return SymEdge whose next is se */
+/** Return SymEdge whose next is se. */
 static inline SymEdge *prev(const SymEdge *se)
 {
   return se->rot->next->rot;
@@ -444,8 +447,9 @@ static CDTEdge *add_diagonal(CDT_state *cdt, SymEdge *s1, SymEdge *s2)
   return ediag;
 }
 
-/* Split se at fraction lambda,
- * and return the new CDTEdge that is the new second half.
+/**
+ * Split \a se at fraction \a lambda,
+ * and return the new #CDTEdge that is the new second half.
  * Copy the edge crep into the new one.
  */
 static CDTEdge *split_edge(CDT_state *cdt, SymEdge *se, double lambda)
@@ -455,7 +459,7 @@ static CDTEdge *split_edge(CDT_state *cdt, SymEdge *se, double lambda)
   CDTVert *v;
   CDTEdge *e;
   SymEdge *sesym, *newse, *newsesym, *senext, *sesymprev, *sesymprevsym;
-  /* split e at lambda */
+  /* Split e at lambda. */
   a = se->vert->co;
   b = se->next->vert->co;
   sesym = sym(se);
@@ -489,7 +493,7 @@ static CDTEdge *split_edge(CDT_state *cdt, SymEdge *se, double lambda)
  * Delete an edge from the structure. The new combined face on either side of
  * the deleted edge will be the one that was e's face; the centroid is updated.
  * There will be now an unused face, marked by setting its deleted flag,
- * and an unused CDTEdge, marked by setting the next and rot pointers of
+ * and an unused #CDTEdge, marked by setting the next and rot pointers of
  * its SymEdges to NULL.
  * <pre>
  *        .  v2               .
@@ -541,7 +545,7 @@ static void delete_edge(CDT_state *cdt, SymEdge *e)
     }
   }
 
-  /* If e was representative symedge for v1 or v2, fix that */
+  /* If e was representative symedge for v1 or v2, fix that. */
   if (v1_isolated)
     v1->symedge = NULL;
   else if (v1->symedge == e)
@@ -551,7 +555,7 @@ static void delete_edge(CDT_state *cdt, SymEdge *e)
   else if (v2->symedge == esym)
     v2->symedge = f;
 
-  /* Mark SymEdge as deleted by setting all its pointers to NULL */
+  /* Mark SymEdge as deleted by setting all its pointers to NULL. */
   e->next = e->rot = NULL;
   esym->next = esym->rot = NULL;
   if (!v1_isolated && !v2_isolated && aface != bface) {
@@ -607,19 +611,19 @@ static CDT_state *cdt_init(double minx, double maxx, double miny, double maxy, d
   cdt->rng = BLI_rng_new(0);
   cdt->epsilon = epsilon;
 
-  /* expand bounding box a bit and make initial CDT from it */
+  /* Expand bounding box a bit and make initial CDT from it. */
   margin = DLNY_MARGIN_PCT * max_dd(maxx - minx, maxy - miny) / 100.0;
   if (margin <= 0.0)
     margin = 1.0;
   if (margin < epsilon)
-    margin = 4 * epsilon; /* make sure constraint verts don't merge with border verts */
+    margin = 4 * epsilon; /* Make sure constraint verts don't merge with border verts. */
   cdt->margin = margin;
   x0 = minx - margin;
   y0 = miny - margin;
   x1 = maxx + margin;
   y1 = maxy + margin;
 
-  /* make a quad, then split it with a diagonal */
+  /* Make a quad, then split it with a diagonal. */
   v[0] = add_cdtvert(cdt, x0, y0);
   v[1] 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list