Changeset 958

Show
Ignore:
Timestamp:
11/06/08 10:42:11 (2 months ago)
Author:
mloskot
Message:

liblas::detail::Point: improved equal-to operation for Point<T> class.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/include/liblas/detail/utility.hpp

    r883 r958  
    194194}; 
    195195 
     196template <typename T>  
     197bool compare_distance(const T& actual, const T& expected); 
     198 
    196199template <typename T> 
    197200struct Point 
    198201{ 
    199     Point() : x(T()), y(T()), z(T()) {} 
    200     Point(T const& x, T const& y, T const& z) : x(x), y(y), z(z) {} 
     202    Point() 
     203        : x(T()), y(T()), z(T()) 
     204    {} 
     205     
     206    Point(T const& x, T const& y, T const& z) 
     207        : x(x), y(y), z(z) 
     208    {} 
     209 
     210    bool equal(Point<T> const& other) const 
     211    { 
     212        return (compare_distance(x, other.x) 
     213                && compare_distance(y, other.y) 
     214                && compare_distance(z, other.z)); 
     215    } 
     216 
    201217    T x; 
    202218    T y; 
    203219    T z; 
    204  
    205     bool equal(Point<T> const& other) const 
    206     { 
    207         return ((x == other.x) && (y == other.y) && (z == other.z)); 
    208     } 
    209220}; 
    210221 
     
    224235struct Extents 
    225236{ 
    226     typename detail::Point < T > min; 
    227     typename detail::Point < T > max; 
     237    Extents() {} 
     238    Extents(detail::Point<T> const& min, detail::Point<T> const& max) 
     239        : min(min), max(max) 
     240    {} 
    228241 
    229242    bool equal(Extents<T> const& other) const 
     
    231244        return (min == other.min && max == other.max); 
    232245    } 
     246 
     247    typename detail::Point<T> min; 
     248    typename detail::Point<T> max; 
    233249}; 
    234250 
     
    259275 
    260276template <typename T>  
    261 bool compare_doubles(const T& actual, const T& expected)  
     277bool compare_distance(const T& actual, const T& expected)  
    262278{  
    263279    const T epsilon = std::numeric_limits<T>::epsilon();