Revision: 55838
http://sourceforge.net/p/brlcad/code/55838
Author: phoenixyjll
Date: 2013-06-25 09:40:14 +0000 (Tue, 25 Jun 2013)
Log Message:
-----------
Fix an opposite logic, and use pointers for ON_X_EVENTs.
Modified Paths:
--------------
brlcad/trunk/src/libbrep/intersect.cpp
Modified: brlcad/trunk/src/libbrep/intersect.cpp
===================================================================
--- brlcad/trunk/src/libbrep/intersect.cpp 2013-06-25 09:00:25 UTC (rev
55837)
+++ brlcad/trunk/src/libbrep/intersect.cpp 2013-06-25 09:40:14 UTC (rev
55838)
@@ -524,7 +524,7 @@
J[1][1] = -derivB.y;
F[0][0] = pointA.x - pointB.x;
F[1][0] = pointA.y - pointB.y;
- if (J.Invert(0.0)) {
+ if (!J.Invert(0.0)) {
// FIXME: More elegant error handling.
bu_log("Inverse failed.\n");
continue;
@@ -626,13 +626,13 @@
double distance = pointA.DistanceTo(pointB);
// Check the validity of the solution
if (distance < intersection_tolerance) {
- ON_X_EVENT Event;
- Event.m_A[0] = pointA;
- Event.m_B[0] = pointB;
- Event.m_a[0] = t_a1;
- Event.m_b[0] = t_b1;
- Event.m_type = ON_X_EVENT::ccx_point;
- x.Append(Event);
+ ON_X_EVENT *Event = new ON_X_EVENT;
+ Event->m_A[0] = pointA;
+ Event->m_B[0] = pointB;
+ Event->m_a[0] = t_a1;
+ Event->m_b[0] = t_b1;
+ Event->m_type = ON_X_EVENT::ccx_point;
+ x.Append(*Event);
}
} else {
// Check overlap
@@ -646,15 +646,15 @@
// Check the validity of the solution
if (distance1 < intersection_tolerance && distance2 <
intersection_tolerance) {
- ON_X_EVENT Event;
- Event.m_A[0] = pointA1;
- Event.m_A[1] = pointA2;
- Event.m_B[0] = pointB1;
- Event.m_B[1] = pointB2;
- Event.m_a[0] = t_a1;
- Event.m_a[1] = t_a2;
- Event.m_b[0] = t_b1;
- Event.m_b[1] = t_b2;
+ ON_X_EVENT *Event = new ON_X_EVENT;
+ Event->m_A[0] = pointA1;
+ Event->m_A[1] = pointA2;
+ Event->m_B[0] = pointB1;
+ Event->m_B[1] = pointB2;
+ Event->m_a[0] = t_a1;
+ Event->m_a[1] = t_a2;
+ Event->m_b[0] = t_b1;
+ Event->m_b[1] = t_b2;
int j;
for (j = 1; j < CCI_OVERLAP_TEST_POINTS; j++) {
double strike = 1.0/CCI_OVERLAP_TEST_POINTS;
@@ -665,28 +665,28 @@
break;
}
if (j != CCI_OVERLAP_TEST_POINTS)
- Event.m_type = ON_X_EVENT::ccx_point;
+ Event->m_type = ON_X_EVENT::ccx_point;
else
- Event.m_type = ON_X_EVENT::ccx_overlap;
- x.Append(Event);
+ Event->m_type = ON_X_EVENT::ccx_overlap;
+ x.Append(*Event);
} else if (distance1 < intersection_tolerance) {
// in case that the second one was not correct
- ON_X_EVENT Event;
- Event.m_A[0] = pointA1;
- Event.m_B[0] = pointB1;
- Event.m_a[0] = t_a1;
- Event.m_b[0] = t_b1;
- Event.m_type = ON_X_EVENT::ccx_point;
- x.Append(Event);
+ ON_X_EVENT *Event = new ON_X_EVENT;
+ Event->m_A[0] = pointA1;
+ Event->m_B[0] = pointB1;
+ Event->m_a[0] = t_a1;
+ Event->m_b[0] = t_b1;
+ Event->m_type = ON_X_EVENT::ccx_point;
+ x.Append(*Event);
} else if (distance2 < intersection_tolerance) {
// in case that the first one was not correct
- ON_X_EVENT Event;
- Event.m_A[0] = pointA2;
- Event.m_B[0] = pointB2;
- Event.m_a[0] = t_a2;
- Event.m_b[0] = t_b2;
- Event.m_type = ON_X_EVENT::ccx_point;
- x.Append(Event);
+ ON_X_EVENT *Event = new ON_X_EVENT;
+ Event->m_A[0] = pointA2;
+ Event->m_B[0] = pointB2;
+ Event->m_a[0] = t_a2;
+ Event->m_b[0] = t_b2;
+ Event->m_type = ON_X_EVENT::ccx_point;
+ x.Append(*Event);
}
}
}
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 Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits