Revision: 54514
http://brlcad.svn.sourceforge.net/brlcad/?rev=54514&view=rev
Author: indianlarry
Date: 2013-03-01 17:24:58 +0000 (Fri, 01 Mar 2013)
Log Message:
-----------
Updated function NeighborAcross() to return pointer to triangle consistent
with NeighborCW() and NeighborCCW() functions. Cleaned up several functions to
pass parameters as references.
Modified Paths:
--------------
brlcad/trunk/src/other/poly2tri/poly2tri/common/shapes.cc
brlcad/trunk/src/other/poly2tri/poly2tri/common/shapes.h
brlcad/trunk/src/other/poly2tri/poly2tri/sweep/sweep.cc
Modified: brlcad/trunk/src/other/poly2tri/poly2tri/common/shapes.cc
===================================================================
--- brlcad/trunk/src/other/poly2tri/poly2tri/common/shapes.cc 2013-03-01
00:29:05 UTC (rev 54513)
+++ brlcad/trunk/src/other/poly2tri/poly2tri/common/shapes.cc 2013-03-01
17:24:58 UTC (rev 54514)
@@ -248,6 +248,17 @@
return neighbors_[0];
}
+// The neighbor across to given point
+Triangle* Triangle::NeighborAcross(Point& opoint)
+{
+ if (&opoint == points_[0]) {
+ return neighbors_[0];
+ } else if (&opoint == points_[1]) {
+ return neighbors_[1];
+ }
+ return neighbors_[2];
+}
+
// The neighbor counter-clockwise to given point
Triangle* Triangle::NeighborCCW(Point& point)
{
@@ -343,17 +354,6 @@
}
}
-// The neighbor across to given point
-Triangle& Triangle::NeighborAcross(Point& opoint)
-{
- if (&opoint == points_[0]) {
- return *neighbors_[0];
- } else if (&opoint == points_[1]) {
- return *neighbors_[1];
- }
- return *neighbors_[2];
-}
-
void Triangle::DebugPrint()
{
using namespace std;
Modified: brlcad/trunk/src/other/poly2tri/poly2tri/common/shapes.h
===================================================================
--- brlcad/trunk/src/other/poly2tri/poly2tri/common/shapes.h 2013-03-01
00:29:05 UTC (rev 54513)
+++ brlcad/trunk/src/other/poly2tri/poly2tri/common/shapes.h 2013-03-01
17:24:58 UTC (rev 54514)
@@ -176,6 +176,7 @@
Triangle* NeighborCW(Point& point);
Triangle* NeighborCCW(Point& point);
+Triangle* NeighborAcross(Point& opoint);
bool GetConstrainedEdgeCCW(Point& p);
bool GetConstrainedEdgeCW(Point& p);
void SetConstrainedEdgeCCW(Point& p, bool ce);
@@ -201,8 +202,6 @@
inline bool IsInterior();
inline void IsInterior(bool b);
-Triangle& NeighborAcross(Point& opoint);
-
void DebugPrint();
private:
Modified: brlcad/trunk/src/other/poly2tri/poly2tri/sweep/sweep.cc
===================================================================
--- brlcad/trunk/src/other/poly2tri/poly2tri/sweep/sweep.cc 2013-03-01
00:29:05 UTC (rev 54513)
+++ brlcad/trunk/src/other/poly2tri/poly2tri/sweep/sweep.cc 2013-03-01
17:24:58 UTC (rev 54514)
@@ -52,8 +52,8 @@
for (size_t i = 1; i < tcx.point_count(); i++) {
Point& point = *tcx.GetPoint(i);
Node* node = &PointEvent(tcx, point);
- for (unsigned int i = 0; i < point.edge_list.size(); i++) {
- EdgeEvent(tcx, point.edge_list[i], node);
+ for (size_t j = 0; j < point.edge_list.size(); j++) {
+ EdgeEvent(tcx, point.edge_list[j], node);
}
}
}
@@ -118,7 +118,7 @@
// We are modifying the constraint maybe it would be better to
// not change the given constraint and just keep a variable for the new
constraint
tcx.edge_event.constrained_edge->q = p1;
- triangle = &triangle->NeighborAcross(point);
+ triangle = triangle->NeighborAcross(point);
EdgeEvent( tcx, ep, *p1, triangle, *p1 );
} else {
std::runtime_error("EdgeEvent - collinear points not supported");
@@ -135,7 +135,7 @@
// We are modifying the constraint maybe it would be better to
// not change the given constraint and just keep a variable for the new
constraint
tcx.edge_event.constrained_edge->q = p2;
- triangle = &triangle->NeighborAcross(point);
+ triangle = triangle->NeighborAcross(point);
EdgeEvent( tcx, ep, *p2, triangle, *p2 );
} else {
std::runtime_error("EdgeEvent - collinear points not supported");
@@ -699,7 +699,7 @@
void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle*
t, Point& p)
{
- Triangle& ot = t->NeighborAcross(p);
+ Triangle& ot = *t->NeighborAcross(p);
Point& op = *ot.OppositePoint(*t, p);
if (&ot == NULL) {
@@ -772,10 +772,10 @@
void Sweep::FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq,
Triangle& flip_triangle,
Triangle& t, Point& p)
{
- Triangle& ot = t.NeighborAcross(p);
+ Triangle& ot = *t.NeighborAcross(p);
Point& op = *ot.OppositePoint(t, p);
- if (&t.NeighborAcross(p) == NULL) {
+ if (t.NeighborAcross(p) == NULL) {
// If we want to integrate the fillEdgeEvent do it here
// With current implementation we should never get here
//throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing
triangle");
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits