getSphereTriangles method
Implementation
List<Triangle> getSphereTriangles(Sphere sphere, List<Triangle> triangles) {
for (int i = 0; i < subTrees.length; i ++ ) {
Octree subTree = subTrees[ i ];
if (!sphere.intersectsBox(subTree.box)) continue;
if ( subTree.triangles.isNotEmpty) {
for (int j = 0; j < subTree.triangles.length; j ++ ) {
if(!triangles.contains(subTree.triangles[j])){
triangles.add( subTree.triangles[ j ] );
}
}
}
else {
subTree.getSphereTriangles(sphere, triangles);
}
}
return triangles;
}