Changeset 19:85538eb6ac6a in rrlib_geometry


Ignore:
Timestamp:
09.01.2012 00:55:55 (8 years ago)
Author:
Tobias Föhst <foehst@…>
Branch:
default
Phase:
public
Message:

Imported tKDTree

Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • make.xml

    r13 r19  
    2121  </rrlib> 
    2222 
     23  <rrlib name="geometry_space_partitioning"> 
     24    <sources> 
     25      space_partitioning/* 
     26    </sources> 
     27  </rrlib> 
     28 
    2329  <testprogram name="geometries"> 
    2430    <sources> 
     
    2733  </testprogram> 
    2834 
     35  <testprogram name="kd_tree"> 
     36    <sources> 
     37      test/test_kd_tree.cpp 
     38    </sources> 
     39  </testprogram> 
     40 
    2941</targets> 
  • tBoundingBox.h

    r14 r19  
    8282  tBoundingBox(); 
    8383 
     84  template <typename TIterator> 
     85  tBoundingBox(TIterator begin, TIterator end); 
     86 
    8487  inline const tPoint &Min() const 
    8588  { 
     
    9598 
    9699  void Add(const tPoint &point); 
     100 
     101  template <typename TIterator> 
     102  void Add(TIterator begin, TIterator end); 
    97103 
    98104  void Add(const tBoundingBox &other); 
  • tBoundingBox.hpp

    r14 r19  
    7272} 
    7373 
     74template <size_t Tdimension, typename TElement> 
     75template <typename TIterator> 
     76tBoundingBox<Tdimension, TElement>::tBoundingBox(TIterator begin, TIterator end) 
     77{ 
     78  this->Reset(); 
     79  this->Add(begin, end); 
     80} 
     81 
    7482//---------------------------------------------------------------------- 
    7583// tBoundingBox Reset 
     
    92100    this->min[i] = std::min(this->min[i], point[i]); 
    93101    this->max[i] = std::max(this->max[i], point[i]); 
     102  } 
     103} 
     104 
     105template <size_t Tdimension, typename TElement> 
     106template <typename TIterator> 
     107void tBoundingBox<Tdimension, TElement>::Add(TIterator begin, TIterator end) 
     108{ 
     109  for (auto it = begin; it != end; ++it) 
     110  { 
     111    this->Add(*it); 
    94112  } 
    95113} 
Note: See TracChangeset for help on using the changeset viewer.