Revision: 73169
          http://sourceforge.net/p/brlcad/code/73169
Author:   starseeker
Date:     2019-05-24 12:34:36 +0000 (Fri, 24 May 2019)
Log Message:
-----------
Stash the min and max edge lengths per face

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

Modified: brlcad/trunk/src/libbrep/cdt.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt.cpp    2019-05-24 11:20:03 UTC (rev 73168)
+++ brlcad/trunk/src/libbrep/cdt.cpp    2019-05-24 12:34:36 UTC (rev 73169)
@@ -151,8 +151,8 @@
     }
 
     // Find for this face, find the minimum and maximum edge polyline segment 
lengths
-    double max_edge_seg = 0.0;
-    double min_edge_seg = DBL_MAX;
+    (*s_cdt->max_edge_seg_len)[face.m_face_index] = 0.0;
+    (*s_cdt->min_edge_seg_len)[face.m_face_index] = DBL_MAX;
     for (int li = 0; li < loop_cnt; li++) {
        int num_loop_points = brep_loop_points[li].Count();
        if (num_loop_points > 1) {
@@ -162,11 +162,11 @@
                p2 = p1;
                p1 = (brep_loop_points[li])[i].p3d;
                fastf_t dist = p1->DistanceTo(*p2);
-               if (dist > max_edge_seg) {
-                   max_edge_seg = dist;
+               if (dist > (*s_cdt->max_edge_seg_len)[face.m_face_index]) {
+                   (*s_cdt->max_edge_seg_len)[face.m_face_index] = dist;
                }
-               if ((dist > SMALL_FASTF) && (dist < min_edge_seg))  {
-                   min_edge_seg = dist;
+               if ((dist > SMALL_FASTF) && (dist < 
(*s_cdt->min_edge_seg_len)[face.m_face_index]))  {
+                   (*s_cdt->min_edge_seg_len)[face.m_face_index] = dist;
                }
            }
        }
@@ -230,7 +230,7 @@
 
     // Sample the surface, independent of the trimming curves, to get points 
that
     // will tie the mesh to the interior surface.
-    getSurfacePoints(s_cdt, face, on_surf_points, min_edge_seg, max_edge_seg);
+    getSurfacePoints(s_cdt, face, on_surf_points);
 
     // Strip out points from the surface that are on the trimming curves.  Trim
     // points require special handling for watertightness and introducing them

Modified: brlcad/trunk/src/libbrep/cdt.h
===================================================================
--- brlcad/trunk/src/libbrep/cdt.h      2019-05-24 11:20:03 UTC (rev 73168)
+++ brlcad/trunk/src/libbrep/cdt.h      2019-05-24 12:34:36 UTC (rev 73169)
@@ -96,6 +96,8 @@
     fastf_t dist;
 
     /* 3D data */
+    std::map<int, double> *min_edge_seg_len;
+    std::map<int, double> *max_edge_seg_len;
     std::vector<ON_3dPoint *> *w3dpnts;
     std::vector<ON_3dPoint *> *w3dnorms;
 
@@ -172,8 +174,7 @@
 void
 getSurfacePoints(struct ON_Brep_CDT_State *s_cdt,
                 const ON_BrepFace &face,
-                ON_2dPointArray &on_surf_points,
-                fastf_t min_edge, fastf_t max_edge);
+                ON_2dPointArray &on_surf_points);
 
 void
 plot_polyline(std::vector<p2t::Point *> *pnts, const char *filename);

Modified: brlcad/trunk/src/libbrep/cdt_surf.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_surf.cpp       2019-05-24 11:20:03 UTC (rev 
73168)
+++ brlcad/trunk/src/libbrep/cdt_surf.cpp       2019-05-24 12:34:36 UTC (rev 
73169)
@@ -554,8 +554,7 @@
 void
 getSurfacePoints(struct ON_Brep_CDT_State *s_cdt,
                 const ON_BrepFace &face,
-                ON_2dPointArray &on_surf_points,
-                fastf_t min_edge, fastf_t max_edge)
+                ON_2dPointArray &on_surf_points)
 {
     double surface_width, surface_height;
 
@@ -595,8 +594,8 @@
        sinfo.v_lower_3dlen = _cdt_get_uv_edge_3d_len(&sinfo, 0, 1);
        sinfo.v_mid_3dlen   = _cdt_get_uv_edge_3d_len(&sinfo, 1, 1);
        sinfo.v_upper_3dlen = _cdt_get_uv_edge_3d_len(&sinfo, 2, 1);
-       sinfo.min_edge = min_edge;
-       sinfo.max_edge = max_edge;
+       sinfo.min_edge = (*s_cdt->min_edge_seg_len)[face.m_face_index];
+       sinfo.max_edge = (*s_cdt->max_edge_seg_len)[face.m_face_index];
 
        // may be a smaller trimmed subset of surface so worth getting
        // face boundary

Modified: brlcad/trunk/src/libbrep/cdt_util.cpp
===================================================================
--- brlcad/trunk/src/libbrep/cdt_util.cpp       2019-05-24 11:20:03 UTC (rev 
73168)
+++ brlcad/trunk/src/libbrep/cdt_util.cpp       2019-05-24 12:34:36 UTC (rev 
73169)
@@ -166,6 +166,9 @@
     cdt->orig_brep = brep;
     cdt->brep = NULL;
 
+    cdt->min_edge_seg_len = new std::map<int, double>;
+    cdt->max_edge_seg_len = new std::map<int, double>;
+
     cdt->w3dpnts = new std::vector<ON_3dPoint *>;
     cdt->vert_pnts = new std::map<int, ON_3dPoint *>;
     cdt->w3dnorms = new std::vector<ON_3dPoint *>;
@@ -235,6 +238,9 @@
     }
     bu_free(s_cdt->on2_to_on3_maps, "degen pnts");
 
+    delete s_cdt->min_edge_seg_len;
+    delete s_cdt->max_edge_seg_len;
+
     delete s_cdt->w3dpnts;
     delete s_cdt->vert_pnts;
     delete s_cdt->w3dnorms;

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