Revision: 74314
          http://sourceforge.net/p/brlcad/code/74314
Author:   starseeker
Date:     2019-11-07 20:16:40 +0000 (Thu, 07 Nov 2019)
Log Message:
-----------
Start working on how to spot and flag the intersection case we need to consider 
(not there yet)

Modified Paths:
--------------
    brlcad/trunk/src/libbrep/cdt_mesh.cpp
    brlcad/trunk/src/libbrep/cdt_ovlps.cpp

Modified: brlcad/trunk/src/libbrep/cdt_mesh.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_mesh.cpp       2019-11-07 17:03:26 UTC (rev 
74313)
+++ brlcad/trunk/src/libbrep/cdt_mesh.cpp       2019-11-07 20:16:40 UTC (rev 
74314)
@@ -41,6 +41,7 @@
 #include "bn/plane.h" /* bn_fit_plane */
 #include "bg/polygon.h"
 #include "bg/tri_pt.h"
+#include "bg/trimesh.h"
 #include "brep.h"
 #include "./cdt_mesh.h"
 #include "./cdt.h"

Modified: brlcad/trunk/src/libbrep/cdt_ovlps.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_ovlps.cpp      2019-11-07 17:03:26 UTC (rev 
74313)
+++ brlcad/trunk/src/libbrep/cdt_ovlps.cpp      2019-11-07 20:16:40 UTC (rev 
74314)
@@ -865,6 +865,8 @@
     int coplanar = 0;
     point_t T1_V[3];
     point_t T2_V[3];
+
+
     VSET(T1_V[0], fmesh1->pnts[t1.v[0]]->x, fmesh1->pnts[t1.v[0]]->y, 
fmesh1->pnts[t1.v[0]]->z);
     VSET(T1_V[1], fmesh1->pnts[t1.v[1]]->x, fmesh1->pnts[t1.v[1]]->y, 
fmesh1->pnts[t1.v[1]]->z);
     VSET(T1_V[2], fmesh1->pnts[t1.v[2]]->x, fmesh1->pnts[t1.v[2]]->y, 
fmesh1->pnts[t1.v[2]]->z);
@@ -878,6 +880,18 @@
            //std::cout << "skipping pnt isect(" << coplanar << "): " << 
(*isectpt1)[X] << "," << (*isectpt1)[Y] << "," << (*isectpt1)[Z] << "\n";
            return 0;
        }
+
+       ON_3dPoint 
problem(3.52639798477575539,8.19444914069358887,23.32079103474493209);
+       if (fmesh1->pnts[t1.v[0]]->DistanceTo(problem) < 0.1 || 
+               fmesh1->pnts[t1.v[1]]->DistanceTo(problem) < 0.1 ||
+               fmesh1->pnts[t1.v[2]]->DistanceTo(problem) < 0.1 ||
+               fmesh2->pnts[t2.v[0]]->DistanceTo(problem) < 0.1 || 
+               fmesh2->pnts[t2.v[1]]->DistanceTo(problem) < 0.1 ||
+               fmesh2->pnts[t2.v[2]]->DistanceTo(problem) < 0.1)
+       {
+           std::cout << "isecting problem tri!\n";
+       }
+
        ON_Line e1(*fmesh1->pnts[t1.v[0]], *fmesh1->pnts[t1.v[1]]);
        ON_Line e2(*fmesh1->pnts[t1.v[1]], *fmesh1->pnts[t1.v[2]]);
        ON_Line e3(*fmesh1->pnts[t1.v[2]], *fmesh1->pnts[t1.v[0]]);
@@ -913,9 +927,69 @@
        }
 
        if (near_edge) {
+#if 0
+           // For both triangles, check that the point furthest from the
+           // edge in question is outside the opposite mesh
+           ON_3dPoint t1_f, t2_f;
+           double cdist = -DBL_MAX;
+           for (int i = 0; i < 3; i++) {
+               ON_3dPoint tp = *fmesh1->pnts[t1.v[i]];
+               double tdist = tp.DistanceTo(nedge.ClosestPointTo(tp));
+               if (tdist > cdist) {
+                   t1_f = tp;
+                   cdist = tdist;
+               }
+           }
+           cdist = -DBL_MAX;
+           for (int i = 0; i < 3; i++) {
+               ON_3dPoint tp = *fmesh2->pnts[t2.v[i]];
+               double tdist = tp.DistanceTo(nedge.ClosestPointTo(tp));
+               if (tdist > cdist) {
+                   t2_f = tp;
+                   cdist = tdist;
+               }
+           }
+           struct ON_Brep_CDT_State *s_cdt1 = (struct ON_Brep_CDT_State 
*)fmesh1->p_cdt;
+           struct ON_Brep_CDT_State *s_cdt2 = (struct ON_Brep_CDT_State 
*)fmesh2->p_cdt;
+           bool t1_f_i = on_point_inside(s_cdt2, &t1_f);
+           bool t2_f_i = on_point_inside(s_cdt1, &t2_f);
+
+           if (!t1_f_i && !t2_f_i) {
+               //std::cout << "edge intersect\n";
+               return 0;
+           } else {
+               if (t1_f_i) {
+                   ON_Plane t2plane = fmesh2->bplane(t2);
+                   double dist = t2plane.DistanceTo(t1_f);
+                   if (dist > 0) {
+                       t1_f_i = false;
+                   } else {
+                       std::cout << "inside per local triangle plane: " << 
dist << ", etol: " << etol << "\n";
+                   }
+               }
+               if (t2_f_i) {
+                   ON_Plane t1plane = fmesh1->bplane(t1);
+                   double dist = t1plane.DistanceTo(t2_f);
+                   if (dist > 0) {
+                       t2_f_i = false;
+                   } else {
+                       std::cout << "inside per local triangle plane: " << 
dist << ", etol: " << etol << "\n";
+                   }
+               }
+               if (!t1_f_i && !t2_f_i) {
+                   //std::cout << "edge intersect\n";
+                   return 0;
+               }
+               std::cout << "edge intersect, but opposite point reporting 
inside\n";
+           }
+#else
            return 0;
+#endif
        }
 
+
+
+
        FILE *plot = fopen("tri_pair.plot3", "w");
        double fpnt_r = -1.0;
        double pnt_r = -1.0;

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



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to