Revision: 73830
          http://sourceforge.net/p/brlcad/code/73830
Author:   starseeker
Date:     2019-09-04 19:38:30 +0000 (Wed, 04 Sep 2019)
Log Message:
-----------
flip the normals if the face is reversed

Modified Paths:
--------------
    brlcad/trunk/src/libbrep/cdt_util.cpp

Modified: brlcad/trunk/src/libbrep/cdt_util.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_util.cpp       2019-09-04 19:19:08 UTC (rev 
73829)
+++ brlcad/trunk/src/libbrep/cdt_util.cpp       2019-09-04 19:38:30 UTC (rev 
73830)
@@ -471,15 +471,18 @@
            for (tr_it = tris.begin(); tr_it != tris.end(); tr_it++) {
                for (size_t j = 0; j < 3; j++) {
                    ON_3dPoint *p3d = fmesh->pnts[(*tr_it).v[j]];
-                   ON_3dPoint *onorm = NULL;
+                   ON_3dPoint onorm;
                    if (s->singular_vert_to_norms->find(p3d) != 
s->singular_vert_to_norms->end()) {
                        // Use calculated normal for singularity points
-                       onorm = (*s->singular_vert_to_norms)[p3d];
+                       onorm = *(*s->singular_vert_to_norms)[p3d];
                    } else {
-                       onorm = fmesh->normals[fmesh->nmap[(*tr_it).v[j]]];
+                       onorm = *fmesh->normals[fmesh->nmap[(*tr_it).v[j]]];
                    }
                    VSET(pt[j], p3d->x, p3d->y, p3d->z);
-                   VSET(nv[j], onorm->x, onorm->y, onorm->z);
+                   if (fmesh->m_bRev) {
+                       onorm = -1 * onorm;
+                   }
+                   VSET(nv[j], onorm.x, onorm.y, onorm.z);
                }
                //tri one
                BN_ADD_VLIST(vlfree, vhead, nv[0], BN_VLIST_TRI_START);

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