/* ----------------------------------------------------------------------- * * This file is part of GEL, http://www.imm.dtu.dk/GEL * Copyright (C) the authors and DTU Informatics * For license and list of authors, see ../../doc/intro.pdf * ----------------------------------------------------------------------- */ #include "BoundingNode.h" #include "BoundingINode.h" #include "BoundingLNode.h" using namespace std; using namespace CGLA; namespace Geometry { template void BoundingNode::sq_distance(const Vec3f& p, float& dmin, float& dmax, float& s) const { BoxType::minmax_sq_dist(p, dmin, dmax); s = 0; } template BoundingNode* BoundingNode::build(std::vector& triangles) { int N = triangles.size(); if(N==1) { const Triangle& t = triangles[0]; #if USE_LEAF_BOXES return new BoundingLNode(BoxType::box_triangle(t), t); #else return new BoundingLNode(t); #endif } else { std::vector triangles_left; std::vector triangles_right; BoxType box = BoxType::box_and_split(triangles, triangles_left, triangles_right); BoundingNode* left = build(triangles_left); BoundingNode* right = build(triangles_right); BoundingNode* bn = new BoundingINode(box, left, right); return bn; } } template class BoundingNode; /* template BoundingNode* BoundingNode::build(std::vector& triangles); */ template class BoundingNode; /*template BoundingNode* BoundingNode::build(std::vector& triangles); */ }