Sanity check, were the changes to PullbackCurve intentional? Noticed that the seam tolerance was loosened when you removed some unreachable code. Nice quellage!
Cheers! Sean On Tuesday, December 29, 2009, at 07:31AM, <[email protected]> wrote: >Revision: 37059 > http://brlcad.svn.sourceforge.net/brlcad/?rev=37059&view=rev >Author: indianlarry >Date: 2009-12-29 12:31:35 +0000 (Tue, 29 Dec 2009) > >Log Message: >----------- >Start of updates to cleanup compile warnings including cleaned up of some >variable shadowing, namespace path additions to standard IO items, cleaned up >of some CPP defs in the STEP generated code(will need to address in 'fedex') > >Modified Paths: >-------------- > brlcad/trunk/src/conv/step/PullbackCurve.cpp > brlcad/trunk/src/conv/step/PullbackCurve.h > >Modified: brlcad/trunk/src/conv/step/PullbackCurve.cpp >=================================================================== >--- brlcad/trunk/src/conv/step/PullbackCurve.cpp 2009-12-29 12:29:07 UTC >(rev 37058) >+++ brlcad/trunk/src/conv/step/PullbackCurve.cpp 2009-12-29 12:31:35 UTC >(rev 37059) >@@ -187,62 +187,6 @@ > } else { > return false; > } >- >- ON_3dVector dt; >- data.curve->Ev1Der(t, pointOnCurve, dt); >- ON_3dVector tangent = data.curve->TangentAt(t); >- //data.surf->GetClosestPoint(pointOnCurve, &a, &b, 0.0001); >- ON_Ray r(pointOnCurve, tangent); >- plane_ray pr; >- brep_get_plane_ray(r, pr); >- ON_3dVector p1; >- double p1d; >- ON_3dVector p2; >- double p2d; >- >- utah_ray_planes(r, p1, p1d, p2, p2d); >- >- VMOVE(pr.n1, p1); >- pr.d1 = p1d; >- VMOVE(pr.n2, p2); >- pr.d2 = p2d; >- >- try { >- const ON_Surface *surf = data.surftree->getSurface(); >- ON_2dPoint uv = >data.surftree->getClosestPointEstimate(knudgedPointOnCurve); >- ON_3dVector dir = surf->NormalAt(uv.x, uv.y); >- dir.Reverse(); >- ON_Ray ray(pointOnCurve, dir); >- brep_get_plane_ray(ray, pr); >- //now use this as guess to iterate to closer solution >- pt2d_t Rcurr; >- pt2d_t new_uv; >- ON_3dPoint pt; >- ON_3dVector su, sv; >- bool found=false; >- fastf_t Dlast = MAX_FASTF; >- for (int i = 0; i < 10; i++) { >- brep_r(surf, pr, uv, pt, su, sv, Rcurr); >- fastf_t d = v2mag(Rcurr); >- if (d < BREP_INTERSECTION_ROOT_EPSILON) { >- TRACE1("R:"<<ON_PRINT2(Rcurr)); >- found = true; break; >- } else if (d > Dlast) { >- found = false; //break; >- break; >- //return brep_edge_check(found, sbv, face, surf, ray, hits); >- } >- brep_newton_iterate(surf, pr, Rcurr, su, sv, uv, new_uv); >- move(uv, new_uv); >- Dlast = d; >- } >- >-/////////////////////////////////////// >- out_pt.Set(uv.x, uv.y); >- return true; >- } catch(...) { >- return false; >- } > } > > >@@ -373,10 +317,10 @@ > // evaluate the b-spline basis function for the given parameter u > // place the results in N[] > N = 0.0; >- if (u == bspline.knots[0]) { >+ if (NEAR_EQUAL(u,bspline.knots[0],PBC_TOL)) { > N[0] = 1.0; > return 0; >- } else if (u == bspline.knots[bspline.m]) { >+ } else if (NEAR_EQUAL(u,bspline.knots[bspline.m],PBC_TOL)) { > N[bspline.n] = 1.0; > return bspline.n; > } >@@ -477,17 +421,17 @@ > q[num_samples+2] = 2*q[num_samples+1] - q[num_samples]; > > ON_2dVector T[num_samples]; >- double a[num_samples]; >+ double A[num_samples]; > for (int k=0; k < num_samples; k++) { > ON_3dVector a = ON_CrossProduct(q[k-1], q[k]); > ON_3dVector b = ON_CrossProduct(q[k+1], q[k+2]); > double alength = a.Length(); > if (NEAR_ZERO(alength, PBC_TOL)) { >- a[k] = 1.0; >+ A[k] = 1.0; > } else { >- a[k] = (a.Length())/(a.Length() + b.Length()); >+ A[k] = (a.Length())/(a.Length() + b.Length()); > } >- T[k] = (1.0 - a[k])*q[k] + a[k]*q[k+1]; >+ T[k] = (1.0 - A[k])*q[k] + A[k]*q[k+1]; > T[k].Unitize(); > } > ON_2dPointArray P[num_samples-1]; >@@ -550,8 +494,8 @@ > > // insert the control points > for (int i = 0; i < n; i++) { >- ON_3dPoint p = control_points[i]; >- c->SetCV(i, p); >+ ON_3dPoint pnt = control_points[i]; >+ c->SetCV(i,pnt); > } > return c; > } >@@ -577,17 +521,17 @@ > q[num_samples + 2] = 2 * q[num_samples + 1] - q[num_samples]; > > ON_3dVector T[num_samples]; >- double a[num_samples]; >+ double A[num_samples]; > for (int k = 0; k < num_samples; k++) { >- ON_3dVector a = ON_CrossProduct(q[k - 1], q[k]); >- ON_3dVector b = ON_CrossProduct(q[k + 1], q[k + 2]); >- double alength = a.Length(); >+ ON_3dVector avec = ON_CrossProduct(q[k - 1], q[k]); >+ ON_3dVector bvec = ON_CrossProduct(q[k + 1], q[k + 2]); >+ double alength = avec.Length(); > if (NEAR_ZERO(alength, PBC_TOL)) { >- a[k] = 1.0; >+ A[k] = 1.0; > } else { >- a[k] = (a.Length()) / (a.Length() + b.Length()); >+ A[k] = (avec.Length()) / (avec.Length() + bvec.Length()); > } >- T[k] = (1.0 - a[k]) * q[k] + a[k] * q[k + 1]; >+ T[k] = (1.0 - A[k]) * q[k] + A[k] * q[k + 1]; > T[k].Unitize(); > } > ON_3dPointArray P[num_samples - 1]; >@@ -647,8 +591,8 @@ > > // insert the control points > for (int i = 0; i < n; i++) { >- ON_3dPoint p = control_points[i]; >- c->SetCV(i, p); >+ ON_3dPoint pnt = control_points[i]; >+ c->SetCV(i, pnt); > } > return c; > } >@@ -696,7 +640,7 @@ > spline.p+1, > spline.n+1); > c->ReserveKnotCapacity(spline.knots.size()-2); >- for (int i = 1; i < spline.knots.size()-1; i++) { >+ for (unsigned int i = 1; i < spline.knots.size()-1; i++) { > c->m_knot[i-1] = spline.knots[i]; > } > >@@ -976,14 +920,14 @@ > if (toUV(*data, pt, knots[i-1]+j*delta, PBC_FROM_OFFSET)) { > samples->Append(pt); > } else { >- //cout << "didn't find point on surface" << std::endl; >+ //std::cout << "didn't find point on surface" << >std::endl; > } > } > } > if (toUV(*data, pt, knots[i], PBC_FROM_OFFSET)) { > samples->Append(pt); > } else { >- //cout << "didn't find point on surface" << std::endl; >+ //std::cout << "didn't find point on surface" << std::endl; > } > } else { > if (i>0) { >@@ -992,13 +936,13 @@ > if (toUV(*data, pt, knots[i-1]+j*delta, -PBC_FROM_OFFSET)) { > samples->Append(pt); > } else { >- //cout << "didn't find point on surface" << std::endl; >+ //std::cout << "didn't find point on surface" << >std::endl; > } > } > if (toUV(*data, pt, knots[i], -PBC_FROM_OFFSET)) { > samples->Append(pt); > } else { >- //cout << "didn't find point on surface" << std::endl; >+ //std::cout << "didn't find point on surface" << std::endl; > } > } > } >@@ -1587,6 +1531,7 @@ > prev = NULL; > } > } >+ return complete; > } > > >@@ -1649,6 +1594,7 @@ > } > } > } >+ return complete; > } > > > >Modified: brlcad/trunk/src/conv/step/PullbackCurve.h >=================================================================== >--- brlcad/trunk/src/conv/step/PullbackCurve.h 2009-12-29 12:29:07 UTC (rev >37058) >+++ brlcad/trunk/src/conv/step/PullbackCurve.h 2009-12-29 12:31:35 UTC (rev >37059) >@@ -67,7 +67,7 @@ > #define NEAR_EQUAL(_a, _b, _tol) (fabs((_a) - (_b)) <= _tol) > #define PBC_TOL 0.000001 > #define PBC_FROM_OFFSET 0.001 >-#define PBC_SEAM_TOL 0.001 >+#define PBC_SEAM_TOL 0.01 > > typedef struct pbc_data { > double tolerance; > > >This was sent by the SourceForge.net collaborative development platform, the >world's largest Open Source development site. > >------------------------------------------------------------------------------ >This SF.Net email is sponsored by the Verizon Developer Community >Take advantage of Verizon's best-in-class app development support >A streamlined, 14 day to market process makes app distribution fast and easy >Join now and get one step closer to millions of Verizon customers >http://p.sf.net/sfu/verizon-dev2dev >_______________________________________________ >BRL-CAD Source Commits mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/brlcad-commits > > ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev _______________________________________________ BRL-CAD Developer mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/brlcad-devel
