Permalink
Browse files

some fixes for my mac ;)

  • Loading branch information...
1 parent 17471cf commit ba964ba43c60493c3601757fec660982ce41ff81 @DerRM DerRM committed May 17, 2012
Showing with 16 additions and 5 deletions.
  1. +5 −0 include/tree.hpp
  2. +11 −5 src/tree.cpp
View
5 include/tree.hpp
@@ -8,8 +8,13 @@
#include "hyperSphere.hpp"
#include "limitedPriorityQueue.hpp"
+#ifdef __APPLE__
+#include <boost/thread/future.hpp>
+#include <boost/thread/thread.hpp>
+#else
#include <future>
#include <thread>
+#endif
typedef std::array<VertexList, 3> ListTriple;
typedef std::pair<VertexList, VertexList> ListPair;
View
16 src/tree.cpp
@@ -5,9 +5,15 @@
#ifdef __APPLE__
#include <GL/glew.h>
#include <GLUT/glut.h>
+
+using namespace boost;
+
#else
#include <GL/glew.h>
#include <GL/glut.h>
+
+using namespace std;
+
#endif
#include <float.h>
@@ -22,9 +28,9 @@ KDTree::KDTree(const VertexList vertices){
VertexList sortedY(vertices);
VertexList sortedZ(vertices);
- std::thread xSorted([&] { std::sort(sortedX.begin(), sortedX.end(), Vertex::sortX); });
- std::thread ySorted([&] { std::sort(sortedY.begin(), sortedY.end(), Vertex::sortY); });
- std::thread zSorted([&] { std::sort(sortedZ.begin(), sortedZ.end(), Vertex::sortZ); });
+ thread xSorted([&] { std::sort(sortedX.begin(), sortedX.end(), Vertex::sortX); });
+ thread ySorted([&] { std::sort(sortedY.begin(), sortedY.end(), Vertex::sortY); });
+ thread zSorted([&] { std::sort(sortedZ.begin(), sortedZ.end(), Vertex::sortZ); });
xSorted.join();
ySorted.join();
zSorted.join();
@@ -87,8 +93,8 @@ NodePtr KDTree::makeTree(size_t depth, const size_t& cellSize, ListTriple& t,
NodePtr leftNode;
NodePtr rightNode;
if(depth < 2){
- std::thread lT([&] { leftNode = makeTree(depth+1, cellSize, left, leftBounds); });
- std::thread rT([&] { rightNode = makeTree(depth+1, cellSize, right, rightBounds); });
+ thread lT([&] { leftNode = makeTree(depth+1, cellSize, left, leftBounds); });
+ thread rT([&] { rightNode = makeTree(depth+1, cellSize, right, rightBounds); });
lT.join();
rT.join();
}else{

0 comments on commit ba964ba

Please sign in to comment.