Revision: 64301
          http://sourceforge.net/p/brlcad/code/64301
Author:   starseeker
Date:     2015-02-26 21:43:44 +0000 (Thu, 26 Feb 2015)
Log Message:
-----------
Move a few things, add some reference links.

Modified Paths:
--------------
    brlcad/trunk/src/libbn/polygon.c

Modified: brlcad/trunk/src/libbn/polygon.c
===================================================================
--- brlcad/trunk/src/libbn/polygon.c    2015-02-26 21:34:54 UTC (rev 64300)
+++ brlcad/trunk/src/libbn/polygon.c    2015-02-26 21:43:44 UTC (rev 64301)
@@ -239,7 +239,19 @@
 }
 
 
+/**
+ * Implementation of Ear Clipping Polygon Triangulation
+ *
+ * Based off of David Eberly's documentation of the algorithm in Triangulation
+ * by Ear Clipping, section 2.
+ * http://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf
+ *
+ * Helpful reference implementations included
+ * https://code.google.com/p/polypartition/ and
+ * http://www.geometrictools.com/GTEngine/Include/GteTriangulateEC.h
+ */
 
+
 typedef struct pt_vertex_ref pt_vr;
 
 struct pt_vertex {
@@ -312,22 +324,21 @@
     vert->isEar = 0; \
 }
 
+#define PT_ADD_TRI(ear) { \
+    struct pt_vertex *p = PT_NEXT(ear); \
+    struct pt_vertex *n = PT_PREV(ear); \
+    local_faces[offset+0] = p->index; \
+    local_faces[offset+1] = ear->index; \
+    local_faces[offset+2] = n->index; \
+    offset = offset + 3; \
+    face_cnt++; \
+}
+
 #define PT_NEXT(v) BU_LIST_PNEXT_CIRC(pt_vertex, &(v->l))
 #define PT_PREV(v) BU_LIST_PPREV_CIRC(pt_vertex, &(v->l))
 
 #define PT_NEXT_REF(v) BU_LIST_PNEXT_CIRC(pt_vertex_ref, &(v->l))
 #define PT_PREV_REF(v) BU_LIST_PPREV_CIRC(pt_vertex_ref, &(v->l))
-/*
-double
-pt_angle(struct pt_vertex *p, struct pt_vertex *n, struct pt_vertex *v, const 
point2d_t *pts) {
-    point2d_t v1, v2;
-    V2SUB2(v1, pts[p->index], pts[v->index]);
-    V2SUB2(v2, pts[n->index], pts[v->index]);
-    V2UNITIZE(v1);
-    V2UNITIZE(v2);
-    return fabs(v1[0]*v2[0] + v1[1]*v2[1]);
-}
-*/
 
 HIDDEN int
 is_inside(const point2d_t p1, const point2d_t p2, const point2d_t p3, const 
point2d_t *test) {
@@ -456,16 +467,6 @@
     return;
 }
 
-#define PT_ADD_TRI(ear) { \
-    struct pt_vertex *p = PT_NEXT(ear); \
-    struct pt_vertex *n = PT_PREV(ear); \
-    local_faces[offset+0] = p->index; \
-    local_faces[offset+1] = ear->index; \
-    local_faces[offset+2] = n->index; \
-    offset = offset + 3; \
-    face_cnt++; \
-}
-
 int bn_polygon_triangulate(int **faces, int *num_faces, const point2d_t *pts, 
size_t npts)
 {
     size_t i = 0;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to