/* * ===================================================================================== * * Filename: hyper_rectangle.h * * Description: * * Version: 1.0 * Created: 04/17/2007 04:38:03 PM EDT * Revision: none * Compiler: gcc * * Author: Nikolaos Vasiloglou (NV), nvasil@ieee.org * Company: Georgia Tech Fastlab-ESP Lab * * ===================================================================================== */ #ifndef U_NVASIL_HYPER_RECTANGLE_H_ #define U_NVASIL_HYPER_RECTANGLE_H_ #include #include #include #include #include "fastlib/fastlib.h" #include "computations_counter.h" using namespace std; template class HyperRectangle { public: typedef typename BASICTYPES::Precision_t Precision_t; typedef typename BASICTYPES::Allocator_t Allocator_t; typedef typename BASICTYPES::Metric_t Metric_t; typedef HyperRectangle HyperRectangle_t; typedef typename Allocator_t:: template ArrayPtr ArrayPtr_t; typedef typename Allocator_t:: template ArrayPtr Array_t; template friend class HyperRectangleTest; static const index_t NullValue=-1; HyperRectangle(); void Init(int32 dimension); void Init(ArrayPtr_t min, ArrayPtr_t max, int32 pivot_dimension, Precision_t pivot_value); ~HyperRectangle() {}; void Destruct(){ } static void *operator new(size_t size); static void operator delete(void *p); HyperRectangle_t &operator=(HyperRectangle_t &); void Alias(const HyperRectangle_t &other); void Copy(const HyperRectangle_t &other, int32 dimension); template bool IsWithin(POINTTYPE point, int32 dimension, Precision_t range, ComputationsCounter &comp); template bool IsWithin(POINTTYPE point, int32 dimension, Precision_t metric_matrix, Precision_t range, ComputationsCounter &comp); Precision_t IsWithin(HyperRectangle_t &hr, int32 dimension, Precision_t range, ComputationsCounter &comp); template bool CrossesBoundaries(POINTTYPE point, int32 dimension, Precision_t range, ComputationsCounter &comp); template static Precision_t Distance(POINTTYPE1 point1, POINTTYPE2 point2, int32 dimension); template static Precision_t Distance(POINTTYPE1 point1, POINTTYPE2 point2, int32 dimension, Precision_t **metric_matrix); static Precision_t Distance(HyperRectangle_t hr1, HyperRectangle_t hr2, int32 dimension, ComputationsCounter &comp); static Precision_t Distance(HyperRectangle_t hr1, HyperRectangle_t hr2, Precision_t threshold_distance, int32 dimension, ComputationsCounter &comp); template pair, typename Allocator_t::template Ptr > ClosestChild(typename Allocator_t::template Ptr left, typename Allocator_t::template Ptr right, POINTTYPE point, int32 dimension, ComputationsCounter &comp); string Print(int32 dimension); Array_t &get_min() { return min_; } Array_t &get_max() { return max_; } int32 get_pivot_dimension() { return pivot_dimension_; } Precision_t get_pivot_value() { return pivot_value_; } void set_pivot_dimension(int32 pivot_dimension) { pivot_dimension_=pivot_dimension; } void set_pivot_value(Precision_t pivot_value) { pivot_value_=pivot_value; } inline void Lock() { max_.Lock(); min_.Lock(); } inline void Unlock() { max_.Unlock(); min_.Unlock(); } private: Array_t min_; Array_t max_; int32 pivot_dimension_; Precision_t pivot_value_; }; #include "hyper_rectangle_impl.h" #endif