51 void createTree(
int maxRecursions = 1,
int rek = 0);
65 std::vector<std::unique_ptr<Octree<T>>>
child;
79 for (
const auto& ptr : O.
child)
107 bool valid[8] = {
true,
true,
true,
true,
true,
true,
true,
true };
108 for (
size_t i = 0; i <
child.size(); i++)
120 child[i]->trimOctree(rek + 1);
125 std::vector<std::unique_ptr<Octree<T> > > hChild;
127 for (
int j = 0; j < hnChilds; j++)
131 hChild.push_back(std::move(
child[j]));
136 child = std::move(hChild);
150 child[i]->delAllChilds();
158 for (
int i = 0; i < 8; i++)
161 auto newChild = std::make_unique<Octree<T>>();
162 newChild->parent =
this;
166 case 0: sx = -1; sy = -1; sz = -1;
break;
167 case 1: sx = +1; sy = -1; sz = -1;
break;
168 case 2: sx = -1; sy = +1; sz = -1;
break;
169 case 3: sx = +1; sy = +1; sz = -1;
break;
170 case 4: sx = -1; sy = -1; sz = +1;
break;
171 case 5: sx = +1; sy = -1; sz = +1;
break;
172 case 6: sx = -1; sy = +1; sz = +1;
break;
173 case 7: sx = +1; sy = +1; sz = +1;
break;
177 newChild->BBox =
Box(P, d,
BBox.n);
179 child.push_back(std::move(newChild));
193 for (
int i = 0; i < 8; i++)
child[i]->
createTree(maxRecursions, rek + 1);
Template class for threedimensional vectors.
class which represents a box (cuboid). It is derived by class ObjectShape This class is mainly used f...
This template class is used for internal purposes and represents an octree.
void delElements()
Deletes all elements.
std::vector< std::unique_ptr< Octree< T > > > child
void delAllChilds()
Delete all children of the Octree.
void setRecursiondepth(int max_recursions)
void setBoundingBox(maths::Vector< double > MP, maths::Vector< double > d)
Set the bounding box of the Octree The bounding box is a circumscribing cuboid with center MP and the...
void trimOctree()
Trims the tree, i.e. removing all empty childs.
bool isLeaf
Sign wether the Octree is a leaf or not.
void createChilds()
Creates the childs of the Octree and calculates the bounding boxes.
void delChild(int i)
Delete the i-th child of the Octree.
void createTree(int maxRecursions=1, int rek=0)
Prepare the tree with recursion depth maxRecursions.
This class describes a triangle, represented by its corner points. It is intented for internal purpos...
Raytracer used for ultrashort pulse calculation with raytracing only.
double rayOctreeIntersection(Octree< triangle > &T, maths::Vector< double > P, maths::Vector< double > k, triangle &D)
bool checkTriangleBoxIntersection(Box B, triangle D)
void writeTriangleOctree(char *Fname, Octree< triangle > &)
std::ostream & operator<<(std::ostream &os, Box B)
output operator for the Box class
void addTriangleToTriangle(Octree< triangle > *O, triangle D, int rek)
This class is used for the iray class. This class is intended for internal use only....
This file contains the Vector template class and some useful functions around this class.