[brlcad-commits] SF.net SVN: brlcad:[51846] brlcad/trunk/src/librt/primitives/nmg/nmg_fuse.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <r_...@us...> - 2012-08-09 18:32:13
|
Revision: 51846 http://brlcad.svn.sourceforge.net/brlcad/?rev=51846&view=rev Author: r_weiss Date: 2012-08-09 18:32:07 +0000 (Thu, 09 Aug 2012) Log Message: ----------- Update to function "nmg_edge_g_fuse" within file "nmg_fuse.c". The change was to correct a problem with the sort ordering and to improve performance. Modified Paths: -------------- brlcad/trunk/src/librt/primitives/nmg/nmg_fuse.c Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_fuse.c =================================================================== --- brlcad/trunk/src/librt/primitives/nmg/nmg_fuse.c 2012-08-09 18:31:46 UTC (rev 51845) +++ brlcad/trunk/src/librt/primitives/nmg/nmg_fuse.c 2012-08-09 18:32:07 UTC (rev 51846) @@ -1188,7 +1188,12 @@ /* 0 = no special case, 1 = infinit ratio, 2 = zero ratio, 3 = point in plane (no ratio) */ char *edge_sc, *edge_sc_xyp, *edge_sc_xzp, *edge_sc_yzp; + vect_t vec_from = {1.0, 0.0, 0.0}; + vect_t vec_to = {0.577350269189625842, 0.577350269189625842, 0.577350269189625842}; + mat_t mat; + bn_mat_fromto(mat, vec_from, vec_to); + /* Make a list of all the edge geometry structs in the model */ nmg_edge_g_tabulate(&etab, magic_p); @@ -1219,15 +1224,16 @@ /* load arrays */ for (i = 0 ; i < etab_cnt ; i++) { - register fastf_t *pt1, *pt2; + point_t pt1, pt2; register fastf_t xdif, ydif, zdif; register fastf_t dist = tol->dist; eg1 = (struct edge_g_lseg *)BU_PTBL_GET(&etab, i); eu1 = BU_LIST_MAIN_PTR(edgeuse, BU_LIST_FIRST(bu_list, &eg1->eu_hd2), l2); - pt1 = eu1->vu_p->v_p->vg_p->coord; - pt2 = eu1->eumate_p->vu_p->v_p->vg_p->coord; + /* rotate the edges to reduce the number of edges parallel with the x and y axis */ + MAT4X3PNT(pt1, mat, eu1->vu_p->v_p->vg_p->coord); + MAT4X3PNT(pt2, mat, eu1->eumate_p->vu_p->v_p->vg_p->coord); xdif = fabs(pt2[X] - pt1[X]); ydif = fabs(pt2[Y] - pt1[Y]); @@ -1235,11 +1241,13 @@ sort_idx_xyp[i] = i; if ((xdif < dist) && (ydif > dist)) { + edge_rr_xyp[i] = MAX_FASTF; edge_sc_xyp[i] = 1; /* no angle in xy plane, vertical line (along y-axis) */ } else if ((xdif > dist) && (ydif < dist)) { edge_sc_xyp[i] = 2; /* no angle in xy plane, horz line (along x-axis) */ } else if ((xdif < dist) && (ydif < dist)) { edge_sc_xyp[i] = 3; /* only a point in the xy plane */ + edge_rr_xyp[i] = -MAX_FASTF; } else { edge_rr_xyp[i] = (pt2[Y] - pt1[Y]) / (pt2[X] - pt1[X]); /* rise over run */ } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |