summaryrefslogtreecommitdiffstats
path: root/BSPTree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'BSPTree.cpp')
-rw-r--r--BSPTree.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/BSPTree.cpp b/BSPTree.cpp
new file mode 100644
index 0000000..b30c907
--- /dev/null
+++ b/BSPTree.cpp
@@ -0,0 +1,25 @@
+#include "BSPTree.h"
+#include <iostream>
+
+BSPTree::BSPTree(const std::list<Triangle> &t) {
+ Vertex center = findCenter(t);
+ std::cout << "Center at (" << center.getX() << ", " << center.getY() << ", " << center.getZ() << std::endl;
+
+
+}
+
+
+Vertex BSPTree::findCenter(const std::list<Triangle> &triangles) {
+ Vector v;
+
+ for(std::list<Triangle>::const_iterator t = triangles.begin(); t != triangles.end(); ++t) {
+ v += Vector(t->getCenter());
+ }
+
+ return v/triangles.size();
+}
+
+const Triangle* BSPTree::findNearestTriangle(const std::list<Triangle> &triangles, const Vertex &v) {
+ Triangle *current = 0;
+ float distance;
+}