Revision: 54049
          http://brlcad.svn.sourceforge.net/brlcad/?rev=54049&view=rev
Author:   starseeker
Date:     2012-12-12 19:56:24 +0000 (Wed, 12 Dec 2012)
Log Message:
-----------
checkpoint

Modified Paths:
--------------
    brlcad/trunk/src/librt/test_subdivision.cpp

Modified: brlcad/trunk/src/librt/test_subdivision.cpp
===================================================================
--- brlcad/trunk/src/librt/test_subdivision.cpp 2012-12-11 23:04:58 UTC (rev 
54048)
+++ brlcad/trunk/src/librt/test_subdivision.cpp 2012-12-12 19:56:24 UTC (rev 
54049)
@@ -94,6 +94,162 @@
     p_a->Append(subdiv_pt);
 }
 
+// Kobbelt sqrt(3)-Subdivision, eqn. 9
+ON_3dPoint p_edge_new(ON_3dPoint *p1, ON_3dPoint *p2, ON_3dPoint *curr) {
+   ON_3dPoint pnew = (10 * *p1 + 16 * *curr + *p2)/27;
+   return pnew;
+}
+ON_3dPoint p_edge_move(ON_3dPoint *p1, ON_3dPoint *p2, ON_3dPoint *curr) {
+   ON_3dPoint pmv = (4 * *p1 + 19 * *curr + 4 * *p2)/27;
+   return pmv;
+}
+
+// Break edge handling cases into functions.  For each 
+
+/* Case 1 - edge with no boundary points, face is internal to mesh
+/ 
+/                                 C 
+/                                / \ 
+/                               / ' \ 
+/                              /  '  \
+/                     P1      /   '   \     P2
+/                            /    '    \
+/                           /   ' P '   \
+/                          /  '       '  \
+/                         / '           ' \
+/                        /'_______________'\
+/                        A                 B
+/ 
+/                                 P3
+*/ 
+// Edge is A->B, all face edges have an additional ajoint face.  New
+// faces associated with A->B are A->P3->P and P->P3->B.
+
+/* Case 2 - edge with one boundary point, face is on border of mesh
+/ 
+/  Edge is A->B.  If iteration count is odd:
+/ 
+/                                 C 
+/                                / \ 
+/                               / ' \ 
+/                              /  '  \
+/                             /   '   \     P2
+/                            /    '    \
+/                           /   ' P '   \
+/                          /  '       '  \
+/                         / '           ' \
+/                        /'_______________'\
+/                        A                 B
+/ 
+/                                 P3
+*/
+// new faces are A->P3->P and P->P3->B
+//
+//
+// If iteration count is even, there are two possible cases - depending on 
P3's A->X edge and
+// whether it has one or two boundary points.
+//
+/* A->X has one boundary point: 
+/ 
+/                                 C 
+/                                / \ 
+/                               /   \ 
+/                         E2   /     \
+/                             /       \     P2
+/                            /         \
+/                     E1    /           \
+/                          /             \
+/                         /               \
+/                        / _______________ \
+/                        A                 B
+/                        \                 /
+/                         \               /
+/                          \     P3      /
+/                           \           /
+/                            \         /
+/                             \       /
+/                         P4   \     /      P5
+/                               \   /
+/                                \ /
+/                                 X
+/                                 
+/ 
+/ 
+*/
+// insert faces  B->E1->P3 and P3->E1->A
+//
+/* A->X has two boundary points: 
+/ 
+/                                 C 
+/                                / \ 
+/                               /   \ 
+/                         E2   /     \
+/                             /       \     P2
+/                            /         \
+/                     E1    /           \
+/                          /             \
+/                         /               \
+/                        / _______________ \
+/                        A                 B
+/                        \                 /
+/                         \               /
+/                          \             /
+/                      E3   \           /
+/                            \         /
+/                             \       /
+/                              \     /      P5
+/                          E4   \   /
+/                                \ /
+/                                 X
+/                                 
+*/ 
+//
+//
+// insert faces  B->E1->E3 and E1->A->E3
+
+
+// Case 3 - edge with two boundary points, face is on border of mesh
+//
+//                                
+/* Edge is A->B.  If iteration count is odd
+/ 
+/ 
+/                                 C 
+/                                / \ 
+/                               / ' \ 
+/                              /  '  \
+/                             /   '   \       
+/                            /    '    \
+/                           /   ' P '   \
+/                          /  '       '  \
+/                         / '           ' \
+/                        /'_______________'\
+/                        A                 B
+/ 
+*/
+// insert one face - A->B->P
+//
+/*  If iteration count is even, 
+/ 
+/ 
+/                                 C 
+/                                / \ 
+/                               /   \ 
+/                              /     \
+/                             /       \       
+/                            /         \
+/                           /           \
+/                          /             \
+/                         /               \
+/                        / _______________ \
+/                        A                 B
+/ 
+/                            E1      E2
+*/ 
+// insert one face - E1 -> E2 -> C
+
+
+
 // Make an edge using consistent vertex ordering
 std::pair<size_t, size_t> mk_edge(size_t pt_A, size_t pt_B)
 {
@@ -187,6 +343,9 @@
 
     // Relax old points here
     for(size_t pcnt = 0; pcnt < (size_t)starting_mesh->points_p0.Count(); 
pcnt++) {
+               mesh->points_p0.Append(*starting_mesh->points_p0.At(pcnt));
+               mesh->iteration_of_insert[pcnt] = 
starting_mesh->iteration_of_insert[pcnt];
+#if 0
        if (outer_pts.find(pcnt) == outer_pts.end()) {
            point_subdiv(mesh->iteration_cnt, pcnt, starting_mesh, 
&(mesh->points_p0));
            mesh->iteration_of_insert[pcnt] = 
starting_mesh->iteration_of_insert[pcnt];
@@ -201,6 +360,7 @@
                mesh->iteration_of_insert[pcnt] = 
starting_mesh->iteration_of_insert[pcnt];
            }
        }
+#endif
     }
     for(f_it = starting_mesh->face_pts.begin(); f_it != 
starting_mesh->face_pts.end(); f_it++) {
        mesh->points_p0.Append(starting_mesh->points_q[(*f_it).first]);
@@ -315,7 +475,8 @@
     // vertices
     ON_3dPointArray points_inf;
     for(size_t v = 0; v < (size_t)mesh->points_p0.Count(); v++) {
-       point_inf(v, mesh, &points_inf);
+        points_inf.Append(*mesh->points_p0.At(v));
+       //point_inf(v, mesh, &points_inf);
     }
     // The subdivision process shrinks the bot relative to its original
     // vertex positions - to better approximate the original surface,

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


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to