void Octree::doFindEdges(const carve::poly::Geometry<3>::face_t &f,
                             Node *node,
                             std::vector<const carve::poly::Geometry<3>::edge_t *> &out,
                             unsigned depth,
                             filter_t filter) const {
      if (node == NULL) {
        return;
      }

      if (node->aabb.intersects(f.aabb) && node->aabb.intersects(f.plane_eqn)) {
        if (node->hasChildren()) {
          for (int i = 0; i < 8; ++i) {
            doFindEdges(f, node->children[i], out, depth + 1, filter);
          }
        } else {
          if (depth < MAX_SPLIT_DEPTH && node->edges.size() > EDGE_SPLIT_THRESHOLD) {
            if (!node->split()) {
              for (int i = 0; i < 8; ++i) {
                doFindEdges(f, node->children[i], out, depth + 1, filter);
              }
              return;
            }
          }
          for (std::vector<const carve::poly::Geometry<3>::edge_t*>::const_iterator it = node->edges.begin(), e = node->edges.end(); it != e; ++it) {
            if ((*it)->tag_once()) {
              if (filter(*it)) {
                out.push_back(*it);
              }
            }
          }
        }
      }
    }
Esempio n. 2
0
    void Octree::doFindEdges(const carve::geom3d::Vector &v,
                             Node *node,
                             std::vector<const carve::poly::Edge<3> *> &out,
                             unsigned depth) const {
      if (node == NULL) {
        return;
      }

      if (node->aabb.containsPoint(v)) {
        if (node->hasChildren()) {
          for (int i = 0; i < 8; ++i) {
            doFindEdges(v, node->children[i], out, depth + 1);
          }
        } else {
          if (depth < MAX_SPLIT_DEPTH && node->edges.size() > EDGE_SPLIT_THRESHOLD) {
            if (!node->split()) {
              for (int i = 0; i < 8; ++i) {
                doFindEdges(v, node->children[i], out, depth + 1);
              }
              return;
            }
          }
          for (std::vector<const carve::poly::Edge<3>*>::const_iterator
                 it = node->edges.begin(), e = node->edges.end(); it != e; ++it) {
            if ((*it)->tag_once()) {
              out.push_back(*it);
            }
          }
        }
      }
    }
 void Octree::findEdgesNear(const carve::poly::Geometry<3>::face_t &f, std::vector<const carve::poly::Geometry<3>::edge_t *> &out, filter_t filter) const {
   tagable::tag_begin();
   doFindEdges(f, root, out, 0, filter);
 }
Esempio n. 4
0
 void Octree::findEdgesNear(const carve::geom3d::Vector &v, std::vector<const carve::poly::Edge<3>*> &out) const {
   tagable::tag_begin();
   doFindEdges(v, root, out, 0);
 }
Esempio n. 5
0
 void Octree::findEdgesNear(const carve::poly::Edge<3> &e, std::vector<const carve::poly::Edge<3>*> &out) const {
   tagable::tag_begin();
   doFindEdges(carve::geom3d::LineSegment(e.v1->v, e.v2->v), root, out, 0);
 }
Esempio n. 6
0
 void Octree::findEdgesNear(const carve::geom::aabb<3> &aabb, std::vector<const carve::poly::Edge<3>*> &out) const {
   tagable::tag_begin();
   doFindEdges(aabb, root, out, 0);
 }