Revision: 57214
http://sourceforge.net/p/brlcad/code/57214
Author: phoenixyjll
Date: 2013-08-28 08:12:20 +0000 (Wed, 28 Aug 2013)
Log Message:
-----------
More work trying to pass ON_Brep::IsValid() - the loop's first trim's m_vi[0]
should be equal to the last's m_vi[1], and use ON_ZERO_TOLERANCE to determine
singular trims, and set the vertex's tolerance to 0.0.
Modified Paths:
--------------
brlcad/trunk/src/libbrep/boolean.cpp
Modified: brlcad/trunk/src/libbrep/boolean.cpp
===================================================================
--- brlcad/trunk/src/libbrep/boolean.cpp 2013-08-28 06:29:41 UTC (rev
57213)
+++ brlcad/trunk/src/libbrep/boolean.cpp 2013-08-28 08:12:20 UTC (rev
57214)
@@ -1126,10 +1126,10 @@
c3d = new ON_PolylineCurve(ptarray);
}
- if (c3d->BoundingBox().Diagonal().Length() < INTERSECTION_TOL) {
+ if (c3d->BoundingBox().Diagonal().Length() < ON_ZERO_TOLERANCE) {
// The trim is singular
if (brep->m_V.Count() == 0)
- brep->NewVertex(c3d->PointAtStart());
+ brep->NewVertex(c3d->PointAtStart(), 0.0);
int ti = brep->AddTrimCurve(loop[k]);
ON_BrepTrim& trim = brep->NewSingularTrim(*brep->m_V.Last(),
breploop, srf->IsIsoparametric(*loop[k]), ti);
trim.m_tolerance[0] = trim.m_tolerance[1] = MAX_FASTF;
@@ -1141,7 +1141,7 @@
ON_2dPoint start = loop[k]->PointAtStart(), end = loop[k]->PointAtEnd();
int start_idx, end_idx;
if (k > 0)
- start_idx = brep->m_V.Count() - 1;
+ start_idx = brep->m_T.Last()->m_vi[1];
else {
start_idx = brep->m_V.Count();
brep->NewVertex(face.SurfaceOf()->PointAt(start.x, start.y), 0.0);
@@ -1177,6 +1177,35 @@
trim.m_tolerance[0] = trim.m_tolerance[1] = MAX_FASTF;
}
+ // If the first trim's m_vi[0] (start) != the last trim's m_vi[1] (end),
+ // change the references of end to start.
+ if (breploop.m_ti.Count()) {
+ int start_vi = brep->m_T[breploop.m_ti[0]].m_vi[0];
+ int end_vi = brep->m_T[*breploop.m_ti.Last()].m_vi[1];
+ if (start_vi != end_vi) {
+ for (int i = 0; i < breploop.m_ti.Count(); i++) {
+ ON_BrepTrim& trim = brep->m_T[breploop.m_ti[i]];
+ if (trim.m_vi[0] == end_vi) {
+ trim.m_vi[0] = start_vi;
+ int &edge_vi = brep->m_E[trim.m_ei].m_vi[trim.m_bRev3d ? 1
: 0];
+ if (edge_vi != start_vi) {
+ // Only need to update the array if edge_vi changes.
+ edge_vi = start_vi;
+ brep->m_V[start_vi].m_ei.Append(trim.m_ei);
+ }
+ } else if (brep->m_T[breploop.m_ti[i]].m_vi[1] == end_vi) {
+ trim.m_vi[1] = start_vi;
+ int &edge_vi = brep->m_E[trim.m_ei].m_vi[trim.m_bRev3d ? 0
: 1];
+ if (edge_vi != start_vi) {
+ edge_vi = start_vi;
+ brep->m_V[start_vi].m_ei.Append(trim.m_ei);
+ }
+ }
+ }
+ brep->m_V[end_vi].m_ei.Empty(); // Or remove this vertex
+ }
+ }
+
//if (brep->m_V.Count() < brep->m_V.Capacity())
//brep->m_V[brep->m_V.Count()].m_ei.Empty();
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits