[Liblas-commits] hg: rename liblas::Range's min and max data members to not inter...

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Jan 10 15:08:27 EST 2011


details:   http://hg.liblas.orghg/rev/027d42c61443
changeset: 2717:027d42c61443
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Jan 10 14:07:52 2011 -0600
description:
rename liblas::Range's min and max data members to not interfere with everybody and their brother's macros of the same name.  Macros are evil.
Subject: hg: a few notes about LASzip

details:   http://hg.liblas.orghg/rev/a75dbd6361e2
changeset: 2718:a75dbd6361e2
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Jan 10 14:08:15 2011 -0600
description:
a few notes about LASzip
Subject: hg: merge

details:   http://hg.liblas.orghg/rev/97ca1d940f20
changeset: 2719:97ca1d940f20
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Jan 10 14:08:20 2011 -0600
description:
merge

diffstat:

 .hgignore                 |    1 +
 doc/zip/index.txt         |   26 ++++++++++
 include/liblas/bounds.hpp |  116 +++++++++++++++++++++++-----------------------
 3 files changed, 85 insertions(+), 58 deletions(-)

diffs (truncated from 313 to 300 lines):

diff -r 8abf523b5a74 -r 97ca1d940f20 .hgignore
--- a/.hgignore	Mon Jan 10 10:40:13 2011 -0600
+++ b/.hgignore	Mon Jan 10 14:08:20 2011 -0600
@@ -106,3 +106,4 @@
 *.vcxproj.filters
 libLAS.opensdf
 libLAS.sdf
+*.tlog
diff -r 8abf523b5a74 -r 97ca1d940f20 doc/zip/index.txt
--- a/doc/zip/index.txt	Mon Jan 10 10:40:13 2011 -0600
+++ b/doc/zip/index.txt	Mon Jan 10 14:08:20 2011 -0600
@@ -25,6 +25,32 @@
 * Current Trunk: http://hg.liblas.org/zip
 
 
+Background
+------------------------------------------------------------------------------
 
+LASzip is a compression library that was developed by `Martin Isenburg`_ for 
+compressing `ASPRS LAS format`_ data in his :ref:`LAStools <lastools_liblas>`.  
+It has been provided as an `LGPL`_-licensed stand-alone software library to allow 
+other softwares that handle LAS data to read and write LASzip-compressed data.  
+libLAS can optionally take advantage of LASzip as of libLAS 1.6.0b4 to read 
+and write compressed data. Currently, both LAStools and libLAS can 
+interchange data using LASzip compression
 
+The compression can be many times smaller and many times
+faster than `bz2`_, `gzip`_, and `rar` due to the fact that it can take advantage 
+of known and regular data patterns that exist in LAS data.  LASzip uses 
+two widely known and open compression techniques that have been adapted to 
+LAS data to accomplish its task.  The first is a 
 
+
+
+
+
+
+
+.. _`Martin Isenburg`: http://www.cs.unc.edu/~isenburg/lastools/
+.. _`ASPRS LAS format`: http://www.asprs.org/society/committees/standards/lidar_exchange_format.html
+.. _`LGPL`: http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License
+.. _`bz2`: http://en.wikipedia.org/wiki/Bzip2
+.. _`gz`: http://en.wikipedia.org/wiki/Gzip
+.. _`rar`: http://en.wikipedia.org/wiki/Rar
\ No newline at end of file
diff -r 8abf523b5a74 -r 97ca1d940f20 include/liblas/bounds.hpp
--- a/include/liblas/bounds.hpp	Mon Jan 10 10:40:13 2011 -0600
+++ b/include/liblas/bounds.hpp	Mon Jan 10 14:08:20 2011 -0600
@@ -65,18 +65,18 @@
 class LAS_DLL Range
 {
 public:
-    T min;
-    T max;
+    T minimum;
+    T maximum;
 
 	typedef T value_type;
 
     Range(T mmin=std::numeric_limits<T>::max(), T mmax=std::numeric_limits<T>::min())
-        : min(mmin), max(mmax) {}
+        : minimum(mmin), maximum(mmax) {}
     
 
     Range(Range const& other)
-        : min(other.min)
-        , max(other.max)
+        : minimum(other.minimum)
+        , maximum(other.maximum)
     {
     }
 
@@ -84,8 +84,8 @@
     {
         if (&rhs != this)
         {
-            min = rhs.min;
-            max = rhs.max;
+            minimum = rhs.minimum;
+            maximum = rhs.maximum;
         }
         return *this;
     }
@@ -103,8 +103,8 @@
     bool equal(Range const& other) const
     {
         
-        if    (!(detail::compare_distance(min, other.min))  
-            || !(detail::compare_distance(max, other.max))) 
+        if    (!(detail::compare_distance(minimum, other.minimum))  
+            || !(detail::compare_distance(maximum, other.maximum))) 
         {
             return false;
         }
@@ -114,61 +114,61 @@
     
     bool overlaps(Range const& r) const 
     {
-        return min <= r.max && max >= r.min;
+        return minimum <= r.maximum && maximum >= r.minimum;
     }
 
     bool contains(Range const& r) const
     {
-        return min <= r.min && r.max <= max;
+        return minimum <= r.minimum && r.maximum <= maximum;
     }
     
     bool contains(T v) const
     {
-        return min <= v && v <= max;
+        return minimum <= v && v <= maximum;
     }
     
     bool empty(void) const 
     {
-        return detail::compare_distance(min, std::numeric_limits<T>::max()) && detail::compare_distance(max, std::numeric_limits<T>::min());
+        return detail::compare_distance(minimum, std::numeric_limits<T>::max()) && detail::compare_distance(maximum, std::numeric_limits<T>::min());
     }
     
     void shift(T v) 
     {
-        min += v;
-        max += v;
+        minimum += v;
+        maximum += v;
     }
     
     void scale(T v) 
     {
-        min *= v;
-        max *= v;
+        minimum *= v;
+        maximum *= v;
     }
     
     void clip(Range const& r)
     {
-        if (r.min > min)
-            min = r.min;
-        if (r.max < max)
-            max = r.max;
+        if (r.minimum > minimum)
+            minimum = r.minimum;
+        if (r.maximum < maximum)
+            maximum = r.maximum;
     }
     
     void grow(T v) 
     {
-        if (v < min) 
-            min = v;
-        if (v > max)
-            max = v;
+        if (v < minimum) 
+            minimum = v;
+        if (v > maximum)
+            maximum = v;
     }
 
     void grow(Range const& r) 
     {
-        grow(r.min);
-        grow(r.max);
+        grow(r.minimum);
+        grow(r.maximum);
     }
 
     T length() const
     {
-        return max - min;
+        return maximum - minimum;
     }
 };
     
@@ -213,13 +213,13 @@
 {
     ranges.resize(3);
     
-    ranges[0].min = minx;
-    ranges[1].min = miny;
-    ranges[2].min = minz;
+    ranges[0].minimum = minx;
+    ranges[1].minimum = miny;
+    ranges[2].minimum = minz;
 
-    ranges[0].max = maxx;
-    ranges[1].max = maxy;
-    ranges[2].max = maxz;
+    ranges[0].maximum = maxx;
+    ranges[1].maximum = maxy;
+    ranges[2].maximum = maxz;
     
 #ifdef DEBUG
     verify();
@@ -235,11 +235,11 @@
 
     ranges.resize(2);
 
-    ranges[0].min = minx;
-    ranges[1].min = miny;
+    ranges[0].minimum = minx;
+    ranges[1].minimum = miny;
 
-    ranges[0].max = maxx;
-    ranges[1].max = maxy;
+    ranges[0].maximum = maxx;
+    ranges[1].maximum = maxy;
     
 #ifdef DEBUG
     verify();
@@ -251,13 +251,13 @@
 {
     ranges.resize(3);
     
-    ranges[0].min = min.GetX();
-    ranges[1].min = min.GetY();
-    ranges[2].min = min.GetZ();
+    ranges[0].minimum = min.GetX();
+    ranges[1].minimum = min.GetY();
+    ranges[2].minimum = min.GetZ();
 
-    ranges[0].max = max.GetX();
-    ranges[1].max = max.GetY();
-    ranges[2].max = max.GetZ();
+    ranges[0].maximum = max.GetX();
+    ranges[1].maximum = max.GetY();
+    ranges[2].maximum = max.GetZ();
     
 #ifdef DEBUG
     verify();
@@ -294,7 +294,7 @@
         // throw std::runtime_error(msg.str());                
         return 0;
     }
-    return ranges[index].min;
+    return ranges[index].minimum;
 }
 
 void min(std::size_t const& index, T v)
@@ -302,7 +302,7 @@
     if (ranges.size() <= index) {
         ranges.resize(index + 1);
     }
-    ranges[index].min = v;
+    ranges[index].minimum = v;
 }
 
 T max(std::size_t const& index) const
@@ -314,7 +314,7 @@
         // throw std::runtime_error(msg.str());    
         return 0;
     }
-    return ranges[index].max;
+    return ranges[index].maximum;
 }
 
 void max(std::size_t const& index, T v)
@@ -322,19 +322,19 @@
     if (ranges.size() <= index) {
         ranges.resize(index + 1);
     }
-    ranges[index].max = v;
+    ranges[index].maximum = v;
 }
 
 liblas::Point min() {
     liblas::Point p;
     try 
     {
-        p.SetCoordinates(ranges[0].min, ranges[1].min, ranges[2].min);
+        p.SetCoordinates(ranges[0].minimum, ranges[1].minimum, ranges[2].minimum);
     } 
     catch (std::runtime_error const& e)
     {
         ::boost::ignore_unused_variable_warning(e);
-        p.SetCoordinates(ranges[0].min, ranges[1].min, 0);
+        p.SetCoordinates(ranges[0].minimum, ranges[1].minimum, 0);
         
     }
 
@@ -345,23 +345,23 @@
     liblas::Point p;
     try 
     {
-        p.SetCoordinates(ranges[0].max, ranges[1].max, ranges[2].max);
+        p.SetCoordinates(ranges[0].maximum, ranges[1].maximum, ranges[2].maximum);
     } 
     catch (std::runtime_error const& e)
     {
         ::boost::ignore_unused_variable_warning(e);
-        p.SetCoordinates(ranges[0].max, ranges[1].max, 0);
+        p.SetCoordinates(ranges[0].maximum, ranges[1].maximum, 0);
         
     }
     return p;
 }
 
-T minx() const { if (ranges.size() == 0) return 0; return ranges[0].min; }
-T miny() const { if (ranges.size() < 2) return 0; return ranges[1].min; }


More information about the Liblas-commits mailing list