summaryrefslogtreecommitdiff
path: root/src/dxftess-glu.cc
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2013-03-21 03:29:54 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2013-03-21 03:29:54 (GMT)
commitf242a7a6934effdb292c0fedafa954bafc615cc3 (patch)
tree1aa67e86d902fc9f3cd6a756ab36d0572e0318ed /src/dxftess-glu.cc
parent3211e7f1e32cc0df415780f623e19f58c966266f (diff)
backport to boost 1.37. improve dependency build for older lib versions
including the requirement of symlink to $DEPLOYDIR/include/boost if boost is so old that it uses version numbers in the path name
Diffstat (limited to 'src/dxftess-glu.cc')
-rw-r--r--src/dxftess-glu.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/dxftess-glu.cc b/src/dxftess-glu.cc
index 941dbed..3f87729 100644
--- a/src/dxftess-glu.cc
+++ b/src/dxftess-glu.cc
@@ -185,6 +185,17 @@ static bool point_on_line(double *p1, double *p2, double *p3)
return true;
}
+typedef std::pair<int,int> pair_ii;
+inline void do_emplace( boost::unordered_multimap<int, pair_ii> &tri_by_atan2, int ai, const pair_ii &indexes)
+{
+#if BOOST_VERSION >= 104800
+ tri_by_atan2.emplace(ai, indexes);
+#else
+ std::pair< int, pair_ii > tmp( ai, indexes );
+ tri_by_atan2.insert( tmp );
+#endif
+}
+
/*!
up: true if the polygon is facing in the normal direction (i.e. normal = [0,0,1])
rot: CLOCKWISE rotation around positive Z axis
@@ -280,7 +291,7 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool do_trian
for (int j = 0; j < 3; j++) {
int ai = (int)round(atan2(fabs(tess_tri[i].p[(j+1)%3][0] - tess_tri[i].p[j][0]),
fabs(tess_tri[i].p[(j+1)%3][1] - tess_tri[i].p[j][1])) / 0.001);
- tri_by_atan2.emplace(ai, std::pair<int,int>(i, j));
+ do_emplace( tri_by_atan2, ai, std::pair<int,int>(i, j) );
}
while (added_triangles)
{
@@ -321,13 +332,13 @@ void dxf_tesselate(PolySet *ps, DxfData &dxf, double rot, bool up, bool do_trian
for (int m = 0; m < 2; m++) {
int ai = (int)round(atan2(fabs(tess_tri.back().p[(m+1)%3][0] - tess_tri.back().p[m][0]),
fabs(tess_tri.back().p[(m+1)%3][1] - tess_tri.back().p[m][1])) / 0.001 );
- tri_by_atan2.emplace(ai, std::pair<int,int>(tess_tri.size()-1, m));
+ do_emplace(tri_by_atan2, ai, std::pair<int,int>(tess_tri.size()-1, m));
}
tess_tri[i].p[(k+1)%3] = tess_tri[j].p[l];
for (int m = 0; m < 2; m++) {
int ai = (int)round(atan2(fabs(tess_tri[i].p[(m+1)%3][0] - tess_tri[i].p[m][0]),
fabs(tess_tri[i].p[(m+1)%3][1] - tess_tri[i].p[m][1])) / 0.001 );
- tri_by_atan2.emplace(ai, std::pair<int,int>(i, m));
+ do_emplace(tri_by_atan2, ai, std::pair<int,int>(i, m));
}
added_triangles = true;
}
contact: Jan Huwald // Impressum