33 #ifndef __H__LIB_GRID__OCTREE_IMPL__
34 #define __H__LIB_GRID__OCTREE_IMPL__
45 template <
class TIterator>
48 int maxDepth,
int elemThreshold,
bool bLoose,
51 const char* logMsgPrefix =
" CreateOctree: ";
53 if(elemsBegin == elemsEnd)
58 UG_LOG(logMsgPrefix <<
"vertex-attachment missing: aPos\n");
70 const size_t numVertices = (*elemsBegin)->num_vertices();
75 for(TIterator iter = elemsBegin; iter != elemsEnd; ++iter){
76 for(
size_t i = 0; i < numVertices; ++i)
77 aaInt[(*iter)->vertex(i)] = -1;
81 std::vector<vector3> vPoints;
82 std::vector<int> vElems;
83 std::vector<node_tree::CollisionElementID> vElemIDs;
97 for(TIterator iter = elemsBegin; iter != elemsEnd; ++iter){
101 for(
size_t i = 0; i < numVertices; ++i){
102 Vertex* v = elem->vertex(i);
104 aaInt[v] = (int)vPoints.size();
105 vPoints.push_back(aaPos[v]);
108 vElems.push_back(aaInt[v]);
112 vElemIDs.push_back(elem);
120 &vElems.front(), vElems.size(), numVertices,
121 &vElemIDs.front(), maxDepth, elemThreshold, bLoose);
A generic specialization of IAttachment.
Definition: attachment_pipe.h:263
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
void detach_from_vertices(IAttachment &attachment)
Definition: grid.h:787
bool has_vertex_attachment(IAttachment &attachment)
Definition: grid.h:798
void attach_to_vertices(IAttachment &attachment, bool passOnValues)
Definition: grid.h:728
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
node_tree::SPCollisionTreeRootNode SPOctree
Definition: octree.h:52
SPOctree CreateOctree(Grid &grid, TIterator elemsBegin, TIterator elemsEnd, int maxDepth, int elemThreshold, bool bLoose, APosition &aPos=aPosition)
Creates an Octree from a list of edges or triangles.
Definition: octree_impl.hpp:47
#define UG_LOG(msg)
Definition: log.h:367
SPCollisionTreeRootNode CreateOctree(vector3 *points, size_t numPoints, int *elemInds, size_t numElemInds, int numIndsPerElem, CollisionElementID *elemIDs, int maxDepth, int elemThreshold, bool bLoose)
Creates an Octree from a list of elements.
Definition: octree.cpp:119
SmartPtr< CollisionTreeRootNode > SPCollisionTreeRootNode
the smartpointer which will be used to encapsulate the node
Definition: collision_tree_root_node.h:43
T value_type
Definition: sparsematrix_interface.h:2