diff --git a/Announce.txt b/Announce.txt index 3e3f00baf79e9d9f37a15edf64eb62cef2fe31cc..5df761806106aa6daa31a9d01d9d4a159e8c6756 100644 --- a/Announce.txt +++ b/Announce.txt @@ -1,5 +1,5 @@ - Qhull 2010.0.1 2010/01/03 + Qhull 2010.0.2 2010/01/04 http://www.qhull.org git@gitorious.org:qhull/qhull.git diff --git a/README.txt b/README.txt index de59a52dd074aea72c8ff6d4be75b2c80c9b453f..2ce2ecf326f9fa7be5e4c0297dcdda375883e4a9 100644 --- a/README.txt +++ b/README.txt @@ -1,6 +1,6 @@ Name - qhull, rbox 2010.0.1 2010/01/03 + qhull, rbox 2010.0.2 2010/01/04 Convex hull, Delaunay triangulation, Voronoi diagrams, Halfspace intersection diff --git a/cpp/Coordinates.cpp b/cpp/Coordinates.cpp index e66d9eb5edcd082b6f2b184a0d3b2598e3f25602..8940fcbc2ebec001725e7bdcdb46420c3e8fb75d 100644 --- a/cpp/Coordinates.cpp +++ b/cpp/Coordinates.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2009-2010 C.B. Barber. All rights reserved. -** $Id: //product/qhull/main/rel/cpp/Coordinates.cpp#18 $$Change: 1139 $ -** $DateTime: 2010/01/03 11:20:29 $$Author: bbarber $ +** $Id: //product/qhull/main/rel/cpp/Coordinates.cpp#19 $$Change: 1150 $ +** $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ ** ****************************************************************************/ @@ -25,23 +25,23 @@ namespace orgQhull { // Inefficient without result-value-optimization or implicitly shared object Coordinates Coordinates:: -mid(int index, int length) const +mid(int idx, int length) const { int newLength= length; - if(length<0 || index+length > count()){ - newLength= count()-index; + if(length<0 || idx+length > count()){ + newLength= count()-idx; } Coordinates result; if(newLength>0){ - std::copy(begin()+index, begin()+(index+newLength), std::back_inserter(result)); + std::copy(begin()+idx, begin()+(idx+newLength), std::back_inserter(result)); } return result; }//mid coordT Coordinates:: -value(int index, const coordT &defaultValue) const +value(int idx, const coordT &defaultValue) const { - return ((index < 0 || index >= count()) ? defaultValue : (*this)[index]); + return ((idx < 0 || idx >= count()) ? defaultValue : (*this)[idx]); }//value #//Operator @@ -69,10 +69,10 @@ operator+=(const Coordinates &other) #//Read-write coordT Coordinates:: -takeAt(int index) +takeAt(int idx) { - coordT c= at(index); - erase(begin()+index); + coordT c= at(idx); + erase(begin()+idx); return c; }//takeAt @@ -85,10 +85,10 @@ takeLast() }//takeLast void Coordinates:: -swap(int index, int other) +swap(int idx, int other) { - coordT c= at(index); - at(index)= at(other); + coordT c= at(idx); + at(idx)= at(other); at(other)= c; }//swap diff --git a/cpp/Coordinates.h b/cpp/Coordinates.h index 0703118afca3559ada55edb2aec3630196a83acf..f200600bb78d2d7610cb7472aea4e026d474a9f5 100644 --- a/cpp/Coordinates.h +++ b/cpp/Coordinates.h @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2009-2010 C.B. Barber. All rights reserved. -** $Id: //product/qhull/main/rel/cpp/Coordinates.h#30 $$Change: 1139 $ -** $DateTime: 2010/01/03 11:20:29 $$Author: bbarber $ +** $Id: //product/qhull/main/rel/cpp/Coordinates.h#31 $$Change: 1150 $ +** $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ ** ****************************************************************************/ @@ -81,8 +81,8 @@ public: size_t size() const { return coordinate_array.size(); } #//Element access - coordT &at(int index) { return coordinate_array.at(index); } - const coordT &at(int index) const { return coordinate_array.at(index); } + coordT &at(int idx) { return coordinate_array.at(idx); } + const coordT &at(int idx) const { return coordinate_array.at(idx); } coordT &back() { return coordinate_array.back(); } const coordT &back() const { return coordinate_array.back(); } coordT &first() { return front(); } @@ -91,10 +91,10 @@ public: const coordT &front() const { return coordinate_array.front(); } coordT &last() { return back(); } const coordT &last() const { return back(); } - Coordinates mid(int index, int length= -1) const; - coordT &operator[](int index) { return coordinate_array.operator[](index); } - const coordT &operator[](int index) const { return coordinate_array.operator[](index); } - coordT value(int index, const coordT &defaultValue) const; + Coordinates mid(int idx, int length= -1) const; + coordT &operator[](int idx) { return coordinate_array.operator[](idx); } + const coordT &operator[](int idx) const { return coordinate_array.operator[](idx); } + coordT value(int idx, const coordT &defaultValue) const; #//Iterator iterator begin() { return iterator(coordinate_array.begin()); } @@ -110,7 +110,7 @@ public: #//Modify void append(const coordT &c) { push_back(c); } void clear() { coordinate_array.clear(); } - iterator erase(iterator index) { return iterator(coordinate_array.erase(index.base())); } + iterator erase(iterator idx) { return iterator(coordinate_array.erase(idx.base())); } iterator erase(iterator begin, iterator end) { return iterator(coordinate_array.erase(begin.base(), end.base())); } void insert(int before, const coordT &c) { insert(begin()+before, c); } iterator insert(iterator before, const coordT &c) { return iterator(coordinate_array.insert(before.base(), c)); } @@ -125,13 +125,13 @@ public: void push_back(const coordT &c) { coordinate_array.push_back(c); } void push_front(const coordT &c) { insert(begin(), c); } //removeAll below - void removeAt(int index) { erase(begin()+index); } + void removeAt(int idx) { erase(begin()+idx); } void removeFirst() { erase(begin()); } void removeLast() { erase(--end()); } - void replace(int index, const coordT &c) { (*this)[index]= c; } + void replace(int idx, const coordT &c) { (*this)[idx]= c; } void reserve(int i) { coordinate_array.reserve(i); } - void swap(int index, int other); - coordT takeAt(int index); + void swap(int idx, int other); + coordT takeAt(int idx); coordT takeFirst() { return takeAt(0); } coordT takeLast(); @@ -164,7 +164,7 @@ public: std::vector<coordT>::iterator &base() { return i; } // No operator-> for base types coordT &operator*() const { return *i; } - coordT &operator[](int index) const { return i[index]; } + coordT &operator[](int idx) const { return i[idx]; } bool operator==(const iterator &other) const { return i==other.i; } bool operator!=(const iterator &other) const { return i!=other.i; } @@ -184,10 +184,10 @@ public: iterator operator++(int) { return iterator(i++); } iterator operator--() { return iterator(--i); } iterator operator--(int) { return iterator(i--); } - iterator operator+=(int index) { return iterator(i += index); } - iterator operator-=(int index) { return iterator(i -= index); } - iterator operator+(int index) const { return iterator(i+index); } - iterator operator-(int index) const { return iterator(i-index); } + iterator operator+=(int idx) { return iterator(i += idx); } + iterator operator-=(int idx) { return iterator(i -= idx); } + iterator operator+(int idx) const { return iterator(i+idx); } + iterator operator-(int idx) const { return iterator(i-idx); } difference_type operator-(iterator other) const { return i-other.i; } };//Coordinates::iterator @@ -212,7 +212,7 @@ public: // No operator-> for base types // No reference to a base type for () and [] const coordT &operator*() const { return *i; } - const coordT &operator[](int index) const { return i[index]; } + const coordT &operator[](int idx) const { return i[idx]; } bool operator==(const const_iterator &other) const { return i==other.i; } bool operator!=(const const_iterator &other) const { return i!=other.i; } @@ -225,10 +225,10 @@ public: const_iterator operator++(int) { return const_iterator(i++); } const_iterator operator--() { return const_iterator(--i); } const_iterator operator--(int) { return const_iterator(i--); } - const_iterator operator+=(int index) { return const_iterator(i += index); } - const_iterator operator-=(int index) { return const_iterator(i -= index); } - const_iterator operator+(int index) const { return const_iterator(i+index); } - const_iterator operator-(int index) const { return const_iterator(i-index); } + const_iterator operator+=(int idx) { return const_iterator(i += idx); } + const_iterator operator-=(int idx) { return const_iterator(i -= idx); } + const_iterator operator+(int idx) const { return const_iterator(i+idx); } + const_iterator operator-(int idx) const { return const_iterator(i-idx); } difference_type operator-(const_iterator other) const { return i-other.i; } };//Coordinates::const_iterator diff --git a/cpp/QhullHyperplane.h b/cpp/QhullHyperplane.h index 2c41588c82f4dae2fe05cf56e0996b6d627c2858..f96c0571438fe85936456680dad413834847248b 100644 --- a/cpp/QhullHyperplane.h +++ b/cpp/QhullHyperplane.h @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2009-2010 C.B. Barber. All rights reserved. -** $Id: //product/qhull/main/rel/cpp/QhullHyperplane.h#9 $$Change: 1139 $ -** $DateTime: 2010/01/03 11:20:29 $$Author: bbarber $ +** $Id: //product/qhull/main/rel/cpp/QhullHyperplane.h#10 $$Change: 1150 $ +** $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ ** ****************************************************************************/ @@ -94,8 +94,8 @@ public: #//Operator bool operator==(const QhullHyperplane &other) const; bool operator!=(const QhullHyperplane &other) const { return !operator==(other); } - const coordT &operator[](int index) const { QHULL_ASSERT(index>=0 && index<hyperplane_dimension); return *(hyperplane_coordinates+index); } - coordT &operator[](int index) { QHULL_ASSERT(index>=0 && index<hyperplane_dimension); return *(hyperplane_coordinates+index); } + const coordT &operator[](int idx) const { QHULL_ASSERT(idx>=0 && idx<hyperplane_dimension); return *(hyperplane_coordinates+idx); } + coordT &operator[](int idx) { QHULL_ASSERT(idx>=0 && idx<hyperplane_dimension); return *(hyperplane_coordinates+idx); } #//IO struct PrintHyperplane{ diff --git a/cpp/QhullPoint.h b/cpp/QhullPoint.h index fe8a57b54e266a3bfa4d08830da2ff1952d97243..e8082ba7c147eb308ccc8998d162abb0416e60c3 100644 --- a/cpp/QhullPoint.h +++ b/cpp/QhullPoint.h @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2009-2010 C.B. Barber. All rights reserved. -** $Id: //product/qhull/main/rel/cpp/QhullPoint.h#30 $$Change: 1139 $ -** $DateTime: 2010/01/03 11:20:29 $$Author: bbarber $ +** $Id: //product/qhull/main/rel/cpp/QhullPoint.h#31 $$Change: 1150 $ +** $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ ** ****************************************************************************/ @@ -81,7 +81,7 @@ public: bool isDefined() const { return point_coordinates!=0 && point_dimension>0; } #//Define - void advancePoint(int index) { point_coordinates += index*point_dimension; } + void advancePoint(int idx) { point_coordinates += idx*point_dimension; } void defineAs(int dimension, coordT *c) { QHULL_ASSERT(dimension>=0); point_coordinates= c; point_dimension= dimension; } //! Creates an alias to other void defineAs(QhullPoint &other) { point_coordinates= other.coordinates(); point_dimension= other.dimension(); } @@ -104,8 +104,8 @@ public: #//Operator bool operator==(const QhullPoint &other) const; bool operator!=(const QhullPoint &other) const { return !operator==(other); } - const coordT &operator[](int index) const { QHULL_ASSERT(index>=0 && index<point_dimension); return *(point_coordinates+index); } - coordT &operator[](int index) { QHULL_ASSERT(index>=0 && index<point_dimension); return *(point_coordinates+index); } + const coordT &operator[](int idx) const { QHULL_ASSERT(idx>=0 && idx<point_dimension); return *(point_coordinates+idx); } + coordT &operator[](int idx) { QHULL_ASSERT(idx>=0 && idx<point_dimension); return *(point_coordinates+idx); } struct PrintPoint{ const QhullPoint *point; //! FIXUP elsewhere. const is OK now diff --git a/cpp/QhullPointSet.cpp b/cpp/QhullPointSet.cpp index 4068c9fab7471f466ce418b44ae21d6740d91d22..af45d0851dc2c7ce79c597a799687d45a110e9f7 100644 --- a/cpp/QhullPointSet.cpp +++ b/cpp/QhullPointSet.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2009-2010 C.B. Barber. All rights reserved. -** $Id: //product/qhull/main/rel/cpp/QhullPointSet.cpp#8 $$Change: 1139 $ -** $DateTime: 2010/01/03 11:20:29 $$Author: bbarber $ +** $Id: //product/qhull/main/rel/cpp/QhullPointSet.cpp#9 $$Change: 1150 $ +** $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ ** ****************************************************************************/ @@ -19,13 +19,13 @@ namespace orgQhull { #//Element-access //! Derived from QhullSet::value QhullPoint QhullPointSet:: -value(int index) const +value(int idx) const { // Avoid call to qh_setsize() and assert in elementPointer() - //const T *n= reinterpret_cast<const T *>(&SETelem_(getSetT(), index)); - void **n= reinterpret_cast<void **>(&SETelem_(getSetT(), index)); + //const T *n= reinterpret_cast<const T *>(&SETelem_(getSetT(), idx)); + void **n= reinterpret_cast<void **>(&SETelem_(getSetT(), idx)); coordT **n2= reinterpret_cast<coordT **>(n); - if(index>=0 && n<endPointer()){ + if(idx>=0 && n<endPointer()){ return QhullPoint(dimension(), *n2); }else{ return QhullPoint(); @@ -35,12 +35,12 @@ value(int index) const //! Non-const since copy is an alias //! Derived from QhullSet::value QhullPoint QhullPointSet:: -value(int index, QhullPoint &defaultValue) const +value(int idx, QhullPoint &defaultValue) const { // Avoid call to qh_setsize() and assert in elementPointer() - void **n= reinterpret_cast<void **>(&SETelem_(getSetT(), index)); + void **n= reinterpret_cast<void **>(&SETelem_(getSetT(), idx)); coordT **n2= reinterpret_cast<coordT **>(n); - if(index>=0 && n<endPointer()){ + if(idx>=0 && n<endPointer()){ return QhullPoint(dimension(), *n2); }else{ return defaultValue; @@ -94,13 +94,13 @@ count(const QhullPoint &t) const int QhullPointSet:: indexOf(const QhullPoint &t) const { - int index= 0; + int idx= 0; QhullPointSetIterator i(*this); while(i.hasNext()){ if(i.next()==t){ - return index; + return idx; } - ++index; + ++idx; } return -1; }//indexOf @@ -108,16 +108,16 @@ indexOf(const QhullPoint &t) const int QhullPointSet:: lastIndexOf(const QhullPoint &t) const { - int index= count()-1; + int idx= count()-1; QhullPointSetIterator i(*this); i.toBack(); while(i.hasPrevious()){ if(i.previous()==t){ break; } - --index; + --idx; } - return index; + return idx; }//lastIndexOf diff --git a/cpp/QhullPointSet.h b/cpp/QhullPointSet.h index 22869084cbf3425f3012ae5814cff491ae99cee1..ac302ca08c5e7a34ecd3243b0876b72153f188a4 100644 --- a/cpp/QhullPointSet.h +++ b/cpp/QhullPointSet.h @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2009-2010 C.B. Barber. All rights reserved. -** $Id: //product/qhull/main/rel/cpp/QhullPointSet.h#16 $$Change: 1139 $ -** $DateTime: 2010/01/03 11:20:29 $$Author: bbarber $ +** $Id: //product/qhull/main/rel/cpp/QhullPointSet.h#17 $$Change: 1150 $ +** $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ ** ****************************************************************************/ @@ -80,18 +80,18 @@ public: bool operator!=(const QhullPointSet &o) const { return !operator==(o); } #//Element access -- can not return references since QhullPoint must be generated - QhullPoint at(int index) const { return operator[](index); } + QhullPoint at(int idx) const { return operator[](idx); } QhullPoint back() const { return last(); } //! end element is NULL QhullPoint first() const { QHULL_ASSERT(!isEmpty()); return *begin(); } QhullPoint front() const { return first(); } QhullPoint last() const { QHULL_ASSERT(!isEmpty()); return *(end()-1); } // mid() not available. No setT constructor - QhullPoint operator[](int index) const { return QhullPoint(dimension(), QhullSet<coordT *>::operator[](index)); } + QhullPoint operator[](int idx) const { return QhullPoint(dimension(), QhullSet<coordT *>::operator[](idx)); } QhullPoint second() const { return operator[](1); } - QhullPoint value(int index) const; + QhullPoint value(int idx) const; // Non-const since copy is an alias - QhullPoint value(int index, QhullPoint &defaultValue) const; + QhullPoint value(int idx, QhullPoint &defaultValue) const; #//iterator iterator begin() { return iterator(dimension(), reinterpret_cast<coordT **>(beginPointer())); } @@ -131,7 +131,7 @@ public: QhullPoint operator*() const { return QhullPoint(point_dimension, *i); } //operator->() n/a, value-type - QhullPoint operator[](int index) { return QhullPoint(point_dimension, *(i+index)); } + QhullPoint operator[](int idx) { return QhullPoint(point_dimension, *(i+idx)); } bool operator==(const iterator &o) const { return i == o.i && point_dimension == o.point_dimension; } bool operator!=(const iterator &o) const { return !operator==(o); } bool operator==(const const_iterator &o) const @@ -180,7 +180,7 @@ public: const_iterator &operator=(const const_iterator &o) { i= o.i; point_dimension= o.point_dimension; return *this; } QhullPoint operator*() const { return QhullPoint(point_dimension, *i); } - QhullPoint operator[](int index) { return QhullPoint(point_dimension, *(i+index)); } + QhullPoint operator[](int idx) { return QhullPoint(point_dimension, *(i+idx)); } //operator->() n/a, value-type bool operator==(const const_iterator &o) const { return i == o.i && point_dimension == o.point_dimension; } bool operator!=(const const_iterator &o) const { return !operator==(o); } diff --git a/cpp/QhullPoints.cpp b/cpp/QhullPoints.cpp index 7123289cdc228782b868f3c9ba6f054267e747a0..5695d6990e465e9a5484274da5a80067b0f0e250 100644 --- a/cpp/QhullPoints.cpp +++ b/cpp/QhullPoints.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2009-2010 C.B. Barber. All rights reserved. -** $Id: //product/qhull/main/rel/cpp/QhullPoints.cpp#19 $$Change: 1145 $ -** $DateTime: 2010/01/04 21:10:14 $$Author: bbarber $ +** $Id: //product/qhull/main/rel/cpp/QhullPoints.cpp#20 $$Change: 1150 $ +** $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ ** ****************************************************************************/ @@ -37,35 +37,35 @@ operator==(const QhullPoints &other) const #//ElementAccess QhullPoints QhullPoints:: -mid(int index, int length) const +mid(int idx, int length) const { int n= count(); - if(index<0 || index>=n){ + if(idx<0 || idx>=n){ n= 0; - }else if(length<0 || index+length>=n){ - n -= index; + }else if(length<0 || idx+length>=n){ + n -= idx; }else{ - n -= index+length; + n -= idx+length; } - return QhullPoints(point_dimension, n*point_dimension, point_first+index*point_dimension); + return QhullPoints(point_dimension, n*point_dimension, point_first+idx*point_dimension); }//mid QhullPoint QhullPoints:: -value(int index) const +value(int idx) const { QhullPoint p; - if(index>=0 && index<count()){ - p.defineAs(point_dimension, point_first+index*point_dimension); + if(idx>=0 && idx<count()){ + p.defineAs(point_dimension, point_first+idx*point_dimension); } return p; }//value QhullPoint QhullPoints:: -value(int index, QhullPoint &defaultValue) const +value(int idx, QhullPoint &defaultValue) const { QhullPoint p; - if(index>=0 && index<count()){ - p.defineAs(point_dimension, point_first+index*point_dimension); + if(idx>=0 && idx<count()){ + p.defineAs(point_dimension, point_first+idx*point_dimension); }else{ p.defineAs(defaultValue); } @@ -108,12 +108,12 @@ indexOf(const coordT *coordinates) const return -1; } size_t offset= coordinates-point_first; - int index= (int)(offset/(size_t)dimension()); // int for error reporting + int idx= (int)(offset/(size_t)dimension()); // int for error reporting int extra= (int)(offset%(size_t)dimension()); if(extra!=0){ - throw QhullError(10066, "Qhull error: coordinates %x are not at point boundary (extra %d at index %d)", extra, index, 0.0, coordinates); + throw QhullError(10066, "Qhull error: coordinates %x are not at point boundary (extra %d at index %d)", extra, idx, 0.0, coordinates); } - return index; + return idx; }//indexOf coordT int QhullPoints:: diff --git a/cpp/QhullPoints.h b/cpp/QhullPoints.h index ad93237858119b459edfb64b07e1eb04ee281080..f76efb1d4fad967a3373c5a878666c9edf3304d6 100644 --- a/cpp/QhullPoints.h +++ b/cpp/QhullPoints.h @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2009-2010 C.B. Barber. All rights reserved. -** $Id: //product/qhull/main/rel/cpp/QhullPoints.h#27 $$Change: 1145 $ -** $DateTime: 2010/01/04 21:10:14 $$Author: bbarber $ +** $Id: //product/qhull/main/rel/cpp/QhullPoints.h#28 $$Change: 1150 $ +** $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ ** ****************************************************************************/ @@ -85,17 +85,17 @@ public: size_t size() const { return (point_dimension ? (point_end-point_first)/point_dimension : 0); } #//ElementAccess -- can not return references to QhullPoint - QhullPoint at(int index) const { coordT *p= point_first+index*point_dimension; QHULL_ASSERT(p<point_end); return QhullPoint(point_dimension, p); } + QhullPoint at(int idx) const { coordT *p= point_first+idx*point_dimension; QHULL_ASSERT(p<point_end); return QhullPoint(point_dimension, p); } QhullPoint back() const { return last(); } QhullPoint first() const { return QhullPoint(point_dimension, point_first); } QhullPoint front() const { return first(); } QhullPoint last() const { return QhullPoint(point_dimension, point_end - point_dimension); } //! Returns a subset of the points, not a copy - QhullPoints mid(int index, int length= -1) const; - QhullPoint operator[](int index) const { return at(index); } - QhullPoint value(int index) const; + QhullPoints mid(int idx, int length= -1) const; + QhullPoint operator[](int idx) const { return at(idx); } + QhullPoint value(int idx) const; // Non-const since copy is an alias - QhullPoint value(int index, QhullPoint &defaultValue) const; + QhullPoint value(int idx, QhullPoint &defaultValue) const; #//Foreach ConstIterator begin() const { return ConstIterator(*this); } @@ -133,7 +133,7 @@ public: QhullPoint *operator->() { return this; } // value instead of reference since advancePoint() modifies self QhullPoint operator*() const { return *this; } - QhullPoint operator[](int index) const { QhullPoint n= *this; n.advancePoint(index); return n; } + QhullPoint operator[](int idx) const { QhullPoint n= *this; n.advancePoint(idx); return n; } bool operator==(const iterator &other) const { QHULL_ASSERT(dimension()==other.dimension()); return coordinates()==other.coordinates(); } bool operator!=(const iterator &other) const { return !operator==(other); } bool operator<(const iterator &other) const { QHULL_ASSERT(dimension()==other.dimension()); return coordinates() < other.coordinates(); } @@ -151,10 +151,10 @@ public: iterator operator++(int) { iterator n= *this; operator++(); return iterator(n); } iterator &operator--() { advancePoint(-1); return *this; } iterator operator--(int) { iterator n= *this; operator--(); return iterator(n); } - iterator &operator+=(int index) { advancePoint(index); return *this; } - iterator &operator-=(int index) { advancePoint(-index); return *this; } - iterator operator+(int index) const { iterator n= *this; n.advancePoint(index); return n; } - iterator operator-(int index) const { iterator n= *this; n.advancePoint(-index); return n; } + iterator &operator+=(int idx) { advancePoint(idx); return *this; } + iterator &operator-=(int idx) { advancePoint(-idx); return *this; } + iterator operator+(int idx) const { iterator n= *this; n.advancePoint(idx); return n; } + iterator operator-(int idx) const { iterator n= *this; n.advancePoint(-idx); return n; } difference_type operator-(iterator other) const { QHULL_ASSERT(dimension()==other.dimension()); return (coordinates()-other.coordinates())/dimension(); } };//QhullPoints::iterator @@ -177,7 +177,7 @@ public: // value/non-const since advancePoint(1), etc. modifies self QhullPoint operator*() const { return *this; } QhullPoint *operator->() { return this; } - QhullPoint operator[](int index) const { QhullPoint n= *this; n.advancePoint(index); return n; } + QhullPoint operator[](int idx) const { QhullPoint n= *this; n.advancePoint(idx); return n; } bool operator==(const const_iterator &other) const { QHULL_ASSERT(dimension()==other.dimension()); return coordinates()==other.coordinates(); } bool operator!=(const const_iterator &other) const { return !operator==(other); } bool operator<(const const_iterator &other) const { QHULL_ASSERT(dimension()==other.dimension()); return coordinates() < other.coordinates(); } @@ -188,10 +188,10 @@ public: const_iterator operator++(int) { const_iterator n= *this; operator++(); return const_iterator(n); } const_iterator &operator--() { advancePoint(-1); return *this; } const_iterator operator--(int) { const_iterator n= *this; operator--(); return const_iterator(n); } - const_iterator &operator+=(int index) { advancePoint(index); return *this; } - const_iterator &operator-=(int index) { advancePoint(-index); return *this; } - const_iterator operator+(int index) const { const_iterator n= *this; n.advancePoint(index); return n; } - const_iterator operator-(int index) const { const_iterator n= *this; n.advancePoint(-index); return n; } + const_iterator &operator+=(int idx) { advancePoint(idx); return *this; } + const_iterator &operator-=(int idx) { advancePoint(-idx); return *this; } + const_iterator operator+(int idx) const { const_iterator n= *this; n.advancePoint(idx); return n; } + const_iterator operator-(int idx) const { const_iterator n= *this; n.advancePoint(-idx); return n; } difference_type operator-(const_iterator other) const { QHULL_ASSERT(dimension()==other.dimension()); return (coordinates()-other.coordinates())/dimension(); } };//QhullPoints::const_iterator diff --git a/cpp/QhullSet.h b/cpp/QhullSet.h index b55a75c6ece71ddfde7621f30ff22a3b445b6986..2212ce03da31bda3dff2a548736a1ab445143997 100644 --- a/cpp/QhullSet.h +++ b/cpp/QhullSet.h @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2008-2010 C.B. Barber. All rights reserved. -** $Id: //product/qhull/main/rel/cpp/QhullSet.h#35 $$Change: 1139 $ -** $DateTime: 2010/01/03 11:20:29 $$Author: bbarber $ +** $Id: //product/qhull/main/rel/cpp/QhullSet.h#36 $$Change: 1150 $ +** $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ ** ****************************************************************************/ @@ -83,7 +83,7 @@ public: #//Element protected: void **beginPointer() const { return &qh_set->e[0].p; } - void **elementPointer(int index) const { QHULL_ASSERT(index>=0 && index<qh_set->maxsize); return &SETelem_(qh_set, index); } + void **elementPointer(int idx) const { QHULL_ASSERT(idx>=0 && idx<qh_set->maxsize); return &SETelem_(qh_set, idx); } //! Always points to 0 void **endPointer() const { int *i=SETsizeaddr_(qh_set); return (*i ? &qh_set->e[(*i)-1].p : reinterpret_cast<void **>(i)); } };//QhullSetBase @@ -141,7 +141,7 @@ public: bool operator!=(const QhullSet<T> &other) const { return !operator==(other); } #//Element access - const T &at(int index) const { return operator[](index); } + const T &at(int idx) const { return operator[](idx); } T &back() { return last(); } T &back() const { return last(); } //! end element is NULL @@ -155,12 +155,12 @@ public: T &last() { QHULL_ASSERT(!isEmpty()); return *(end()-1); } const T &last() const { QHULL_ASSERT(!isEmpty()); return *(end()-1); } // mid() not available. No setT constructor - T &operator[](int index) { T *n= reinterpret_cast<T *>(elementPointer(index)); QHULL_ASSERT(index>=0 && n < reinterpret_cast<T *>(endPointer())); return *n; } - const T &operator[](int index) const { const T *n= reinterpret_cast<const T *>(elementPointer(index)); QHULL_ASSERT(index>=0 && n < reinterpret_cast<T *>(endPointer())); return *n; } + T &operator[](int idx) { T *n= reinterpret_cast<T *>(elementPointer(idx)); QHULL_ASSERT(idx>=0 && n < reinterpret_cast<T *>(endPointer())); return *n; } + const T &operator[](int idx) const { const T *n= reinterpret_cast<const T *>(elementPointer(idx)); QHULL_ASSERT(idx>=0 && n < reinterpret_cast<T *>(endPointer())); return *n; } T &second() { return operator[](1); } const T &second() const { return operator[](1); } - T value(int index) const; - T value(int index, const T &defaultValue) const; + T value(int idx) const; + T value(int idx, const T &defaultValue) const; #//Read-write -- Not available, no setT constructor @@ -255,20 +255,20 @@ toQList() const template <typename T> T QhullSet<T>:: -value(int index) const +value(int idx) const { // Avoid call to qh_setsize() and assert in elementPointer() - const T *n= reinterpret_cast<const T *>(&SETelem_(getSetT(), index)); - return (index>=0 && n<end()) ? *n : T(); + const T *n= reinterpret_cast<const T *>(&SETelem_(getSetT(), idx)); + return (idx>=0 && n<end()) ? *n : T(); }//value template <typename T> T QhullSet<T>:: -value(int index, const T &defaultValue) const +value(int idx, const T &defaultValue) const { // Avoid call to qh_setsize() and assert in elementPointer() - const T *n= reinterpret_cast<const T *>(&SETelem_(getSetT(), index)); - return (index>=0 && n<end()) ? *n : defaultValue; + const T *n= reinterpret_cast<const T *>(&SETelem_(getSetT(), idx)); + return (idx>=0 && n<end()) ? *n : defaultValue; }//value #//Search diff --git a/cpp/qhulltest/QhullPoint_test.cpp b/cpp/qhulltest/QhullPoint_test.cpp index 710d1b8bdb00254f528b351204aebf6c52663773..455b600c1dabacc92bee8cfcf00af1a5b1007fde 100644 --- a/cpp/qhulltest/QhullPoint_test.cpp +++ b/cpp/qhulltest/QhullPoint_test.cpp @@ -1,8 +1,8 @@ /**************************************************************************** ** ** Copyright (C) 2008-2010 C.B. Barber. All rights reserved. -** $Id: //product/qhull/main/rel/cpp/qhulltest/QhullPoint_test.cpp#14 $$Change: 1139 $ -** $DateTime: 2010/01/03 11:20:29 $$Author: bbarber $ +** $Id: //product/qhull/main/rel/cpp/qhulltest/QhullPoint_test.cpp#15 $$Change: 1150 $ +** $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ ** ****************************************************************************/ @@ -144,11 +144,11 @@ t_define() QVERIFY(p==p2); QhullPoint p3= vs.last().point(); QVERIFY(p2!=p3); - int index= (p3.coordinates()-p2.coordinates())/p2.dimension(); - QVERIFY(index>-8 && index<8); - p2.advancePoint(index); + int idx= (p3.coordinates()-p2.coordinates())/p2.dimension(); + QVERIFY(idx>-8 && idx<8); + p2.advancePoint(idx); QVERIFY(p2==p3); - p2.advancePoint(-index); + p2.advancePoint(-idx); QVERIFY(p2==p); p2.advancePoint(0); QVERIFY(p2==p); diff --git a/qtpro/libqhull/libqhull.pro b/qtpro/libqhull/libqhull.pro index 13a56e5006f34849fefbf0a699d6d25be7ea6708..4603725a52cc94ccf0a2ee7136782ba15da265e0 100644 --- a/qtpro/libqhull/libqhull.pro +++ b/qtpro/libqhull/libqhull.pro @@ -6,7 +6,8 @@ DESTDIR = ../.. TEMPLATE = lib CONFIG += staticlib warn_on CONFIG -= app_bundle qt -QMAKE_CFLAGS += -fno-strict-aliasing +# Appears to be needed for gcc 4.1, 4.2, and 4.3 with -O2 +#QMAKE_CFLAGS += -fno-strict-aliasing QMAKE_CFLAGS += -Wall -Wextra -Wshadow -Wcast-qual -Wwrite-strings QMAKE_CFLAGS += -Wno-sign-conversion # Many size_t vs. int errors #QMAKE_CFLAGS_DEBUG += -Wconversion # no workaround for bit-field conversion errors diff --git a/qtpro/qconvex/qconvex.pro b/qtpro/qconvex/qconvex.pro index 15515e35b4aab6b71a5d2ef08462c23dd41d77de..f00fb8e83521774ba8b2e64e0c399c39ae404628 100644 --- a/qtpro/qconvex/qconvex.pro +++ b/qtpro/qconvex/qconvex.pro @@ -8,7 +8,6 @@ TEMPLATE = app CONFIG += console warn_on CONFIG -= app_bundle LIBS += -L../.. -QMAKE_CFLAGS += -fno-strict-aliasing QMAKE_CFLAGS += -Wall -Wextra -Wshadow -Wcast-qual -Wwrite-strings QMAKE_CFLAGS += -Wno-sign-conversion # Many size_t vs. int errors build_pass:CONFIG(debug, debug|release):{ diff --git a/qtpro/qdelaunay/qdelaunay.pro b/qtpro/qdelaunay/qdelaunay.pro index e24703ce34f9fc9f5461f5b8e3aae8e0379e166f..a10ae1e7c00ee19af28f9e918ab3d1845fc1eff3 100644 --- a/qtpro/qdelaunay/qdelaunay.pro +++ b/qtpro/qdelaunay/qdelaunay.pro @@ -8,7 +8,6 @@ TEMPLATE = app CONFIG += console warn_on CONFIG -= app_bundle LIBS += -L../.. -QMAKE_CFLAGS += -fno-strict-aliasing QMAKE_CFLAGS += -Wall -Wextra -Wshadow -Wcast-qual -Wwrite-strings QMAKE_CFLAGS += -Wno-sign-conversion # Many size_t vs. int errors build_pass:CONFIG(debug, debug|release):{ diff --git a/qtpro/qhalf/qhalf.pro b/qtpro/qhalf/qhalf.pro index a6a522d8f143f223b2c8909b91b3d9cae4f18cf2..b2227f44164ed3f76645c06b2cfe03a974c32f2e 100644 --- a/qtpro/qhalf/qhalf.pro +++ b/qtpro/qhalf/qhalf.pro @@ -8,7 +8,6 @@ TEMPLATE = app CONFIG += console warn_on CONFIG -= app_bundle LIBS += -L../.. -# QMAKE_CFLAGS += -fno-strict-aliasing QMAKE_CFLAGS += -Wall -Wextra -Wshadow -Wcast-qual -Wwrite-strings QMAKE_CFLAGS += -Wno-sign-conversion # Many size_t vs. int errors build_pass:CONFIG(debug, debug|release):{ diff --git a/qtpro/qhull/qhull.pro b/qtpro/qhull/qhull.pro index 910bd52b3f3adcc80cbed03e66af494cd26bcd9e..ad799d29cb052581f40b452046e0de079eb289ec 100644 --- a/qtpro/qhull/qhull.pro +++ b/qtpro/qhull/qhull.pro @@ -8,7 +8,6 @@ TEMPLATE = app CONFIG += console warn_on CONFIG -= app_bundle LIBS += -L../.. -QMAKE_CFLAGS += -fno-strict-aliasing QMAKE_CFLAGS += -Wall -Wextra -Wshadow -Wcast-qual -Wwrite-strings QMAKE_CFLAGS += -Wno-sign-conversion # Many size_t vs. int errors build_pass:CONFIG(debug, debug|release):{ diff --git a/qtpro/qvoronoi/qvoronoi.pro b/qtpro/qvoronoi/qvoronoi.pro index 53898d8d32ad9328b5309b6328fbf69a08e0810b..884bffbfb35fb3462caf7775df4c04f4a1aec3cb 100644 --- a/qtpro/qvoronoi/qvoronoi.pro +++ b/qtpro/qvoronoi/qvoronoi.pro @@ -8,7 +8,6 @@ TEMPLATE = app CONFIG += console warn_on CONFIG -= app_bundle LIBS += -L../.. -QMAKE_CFLAGS += -fno-strict-aliasing QMAKE_CFLAGS += -Wall -Wextra -Wshadow -Wcast-qual -Wwrite-strings QMAKE_CFLAGS += -Wno-sign-conversion # Many size_t vs. int errors build_pass:CONFIG(debug, debug|release):{ diff --git a/qtpro/rbox/rbox.pro b/qtpro/rbox/rbox.pro index 846f506fcf2153cf4783cedcc94255add4ba8078..674817c25a8f92c849407fb0b23f1500b6088fd9 100644 --- a/qtpro/rbox/rbox.pro +++ b/qtpro/rbox/rbox.pro @@ -6,7 +6,6 @@ DESTDIR = ../.. TEMPLATE = app CONFIG += console warn_on LIBS += -L../.. -QMAKE_CFLAGS += -fno-strict-aliasing QMAKE_CFLAGS += -Wall -Wextra -Wshadow -Wcast-qual -Wwrite-strings QMAKE_CFLAGS += -Wno-sign-conversion # Many size_t vs. int errors build_pass:CONFIG(debug, debug|release):{ diff --git a/qtpro/user_eg/user_eg.pro b/qtpro/user_eg/user_eg.pro index 5e99dd4acc3237a3db71801f32adbf0cf4da5697..70a8521176a3b7a75e3fb3903eb87baa0621e8cd 100644 --- a/qtpro/user_eg/user_eg.pro +++ b/qtpro/user_eg/user_eg.pro @@ -7,7 +7,6 @@ TEMPLATE = app CONFIG += console warn_on CONFIG -= app_bundle LIBS += -L../.. -QMAKE_CFLAGS += -fno-strict-aliasing QMAKE_CFLAGS += -Wall -Wextra -Wshadow -Wcast-qual -Wwrite-strings QMAKE_CFLAGS += -Wno-sign-conversion # Many size_t vs. int errors build_pass:CONFIG(debug, debug|release):{ diff --git a/qtpro/user_eg2/user_eg2.pro b/qtpro/user_eg2/user_eg2.pro index acda9fbb3d5c703a0d158d103149ddbbe57800a1..869bfd8a2a2447fb89fd225539baefa6e4031506 100644 --- a/qtpro/user_eg2/user_eg2.pro +++ b/qtpro/user_eg2/user_eg2.pro @@ -7,7 +7,6 @@ TEMPLATE = app CONFIG += console warn_on CONFIG -= app_bundle LIBS += -L../.. -QMAKE_CFLAGS += -fno-strict-aliasing QMAKE_CFLAGS += -Wall -Wextra -Wshadow -Wcast-qual -Wwrite-strings QMAKE_CFLAGS += -Wno-sign-conversion # Many size_t vs. int errors build_pass:CONFIG(debug, debug|release):{ diff --git a/src/Changes.txt b/src/Changes.txt index 682ec634c3c24b9d9f3832f6b4d54ff4e26db4ad..be9f9ad6f7106b637de1e02b633add1f3fa79e13 100644 --- a/src/Changes.txt +++ b/src/Changes.txt @@ -51,6 +51,7 @@ Qhull cpp questions - How to configure Qhull output. Trace and results should go to stdout/stderr - Qhull and RboxPoints messaging. e.g., ~Qhull, hasQhullMessage() - rename as QhullErrorMessage? + - Is idx the best name for an index? It's rather cryptic, but BSD strings.h defines index(). - Qhull::feasiblePoint Qhull::useOutputStream as field or getter? - Define virtual functions for user customization of Qhull (e.g., qh_fprintf, qh_memfree,etc.) - Figure out RoadError::global_log. clearQhullMessage currently clearGlobalLog @@ -91,11 +92,12 @@ To do - Add vcproj for qconvex, etc. - Review all ptr_intT - Change tabs to spaces in src/*.c *.h + - Check for wraparound of 64-bit ints -- e.g., a large set - Reconsider old_qhstat data type (amorilia) libqhull.h: qhstatT *old_qhstat; /* for saving qh_qhstat in save_qhull() and UsingLibQhull. Free with qh_free() */ mem.h: setT *tempstack; /* stack of temporary memory, managed by users */ - - Run qhull regression tests + - Ran qhull regression tests (eg/q_test) Review the following problems Output warning Qc rbox d D2 | qhull FQ n | qhalf s H0 Fc FP Fn FN FQ Fv Fx @@ -113,7 +115,7 @@ To do Statistics for: rbox 1000 s W1e-13 t | qhull d Tv -qhull 2010.0.2 +qhull 2010.0.2 2010/01/04 Fixed bugs - qh_gethash [poly.c]: fix sign conversion. Previously, the result may be negative, leading to a segfault. @@ -124,10 +126,11 @@ Breaking code changes - Return type of qh_gethash changed from unsigned to int. Matches 'size' - addhash takes a signed hash qh_addhash( newelem, hashtable, hashsize, hash ) -- Check for wraparound of 64-bit ints -- e.g., a large set Code changes - Test for qh_qh in qh_printf +- Makefile.txt corrected for libqhull build [amorilia] +- Renamed index to idx to avoid shadowing BSD strings.h [kwilliams] qhull 2010.0.1 2010/01/03 diff --git a/src/global.c b/src/global.c index cf55d2b5afae6f4da83d10b3900b1af151affab1..7bbfb0494430c3562fd7bedfb07b6ab508adcbe8 100644 --- a/src/global.c +++ b/src/global.c @@ -12,8 +12,8 @@ see qhull_a.h for internal functions copyright (c) 1993-2010 The Geometry Center. - $Id: //product/qhull/main/rel/src/global.c#51 $$Change: 1139 $ - $DateTime: 2010/01/03 11:20:29 $$Author: bbarber $ + $Id: //product/qhull/main/rel/src/global.c#53 $$Change: 1150 $ + $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ */ #include "qhull_a.h" @@ -47,7 +47,7 @@ qhT qh_qh; /* all global variables. recompile user_eg.c, rbox.c, libqhull.c, qconvex.c, qdelaun.c qvoronoi.c, qhalf.c */ -const char *qh_version = "2010.0.1 2010/01/03"; +const char *qh_version = "2010.0.2 2010/01/04"; /*-<a href="qh-globa.htm#TOC" >-------------------------------</a><a name="appendprint">-</a> @@ -1909,7 +1909,7 @@ void qh_initqhull_start2(FILE *infile, FILE *outfile, FILE *errfile) { */ void qh_initthresholds(char *command) { realT value; - int index, maxdim, k; + int idx, maxdim, k; char *s= command; /* non-const due to strtol */ char key; @@ -1928,10 +1928,10 @@ void qh_initthresholds(char *command) { key, s-1); continue; } - index= qh_strtol(s, &s); - if (index >= qh hull_dim) { + idx= qh_strtol(s, &s); + if (idx >= qh hull_dim) { qh_fprintf(qh ferr, 7045, "qhull warning: dimension %d for Print option '%c' is >= %d. Ignored\n", - index, key, qh hull_dim); + idx, key, qh hull_dim); continue; } if (*s == ':') { @@ -1945,9 +1945,9 @@ void qh_initthresholds(char *command) { }else value= 0.0; if (key == 'd') - qh lower_threshold[index]= value; + qh lower_threshold[idx]= value; else - qh upper_threshold[index]= value; + qh upper_threshold[idx]= value; } } }else if (*s == 'Q') { @@ -1967,10 +1967,10 @@ void qh_initthresholds(char *command) { key); continue; } - index= qh_strtol(s, &s); - if (index >= maxdim) { + idx= qh_strtol(s, &s); + if (idx >= maxdim) { qh_fprintf(qh ferr, 7048, "qhull warning: dimension %d for Qhull option %c is >= %d. Ignored\n", - index, key, maxdim); + idx, key, maxdim); continue; } if (*s == ':') { @@ -1981,9 +1981,9 @@ void qh_initthresholds(char *command) { else value= qh_DEFAULTbox; if (key == 'b') - qh lower_bound[index]= value; + qh lower_bound[idx]= value; else - qh upper_bound[index]= value; + qh upper_bound[idx]= value; } } }else { diff --git a/src/libqhull.c b/src/libqhull.c index c985695feac36dcc54add73a39f38d7b6224b844..b2a5a42446a12c983344ebc36f2c799756885be0 100644 --- a/src/libqhull.c +++ b/src/libqhull.c @@ -11,8 +11,8 @@ see qhull_a.h for internal functions copyright (c) 1993-2010 The Geometry Center. - $Id: //product/qhull/main/rel/src/libqhull.c#4 $$Change: 1147 $ - $DateTime: 2010/01/04 21:29:16 $$Author: bbarber $ + $Id: //product/qhull/main/rel/src/libqhull.c#5 $$Change: 1150 $ + $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ */ #include "qhull_a.h" @@ -659,7 +659,7 @@ QhullPoint p%d was above all facets.\n", qh_pointid(point)); */ pointT *qh_nextfurthest(facetT **visible) { facetT *facet; - int size, index; + int size, idx; realT randr, dist; pointT *furthest; @@ -709,21 +709,21 @@ pointT *qh_nextfurthest(facetT **visible) { } randr= qh_RANDOMint; randr= randr/(qh_RANDOMmax+1); - index= (int)floor((qh num_outside - outcoplanar) * randr); + idx= (int)floor((qh num_outside - outcoplanar) * randr); FORALLfacet_(qh facet_next) { if (facet->outsideset) { SETreturnsize_(facet->outsideset, size); if (!size) qh_setfree(&facet->outsideset); - else if (size > index) { + else if (size > idx) { *visible= facet; - return((pointT*)qh_setdelnth(facet->outsideset, index)); + return((pointT*)qh_setdelnth(facet->outsideset, idx)); }else - index -= size; + idx -= size; } } qh_fprintf(qh ferr, 6169, "qhull internal error (qh_nextfurthest): num_outside %d is too low\nby at least %d, or a random real %g >= 1.0\n", - qh num_outside, index+1, randr); + qh num_outside, idx+1, randr); qh_errexit(qh_ERRqhull, NULL, NULL); }else { /* VIRTUALmemory */ facet= qh facet_tail->previous; diff --git a/src/mem.c b/src/mem.c index 0d4232c9a995fc0f3dd2624341dce723e0cbd8c8..9c6946e0f74044ea5762586bc81b06888ea439e9 100644 --- a/src/mem.c +++ b/src/mem.c @@ -30,8 +30,8 @@ global.c (qh_initbuffers) for an example of using mem.c copyright (c) 1993-2010 The Geometry Center. - $Id: //product/qhull/main/rel/src/mem.c#30 $$Change: 1137 $ - $DateTime: 2010/01/02 21:58:11 $$Author: bbarber $ + $Id: //product/qhull/main/rel/src/mem.c#31 $$Change: 1150 $ + $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ */ #include "mem.h" @@ -110,15 +110,15 @@ static int qh_intcompare(const void *i, const void *j) { */ void *qh_memalloc(int insize) { void **freelistp, *newbuffer; - int index, size, n; + int idx, size, n; int outsize, bufsize; void *object; if (insize <= qhmem.LASTsize) { - index= qhmem.indextable[insize]; - outsize= qhmem.sizetable[index]; + idx= qhmem.indextable[insize]; + outsize= qhmem.sizetable[idx]; qhmem.totshort += outsize; - freelistp= qhmem.freelists+index; + freelistp= qhmem.freelists+idx; if ((object= *freelistp)) { qhmem.cntquick++; qhmem.totfree -= outsize; @@ -207,23 +207,23 @@ void *qh_memalloc(int insize) { */ void qh_memfree(void *object, int insize) { void **freelistp; - int index, outsize; + int idx, outsize; if (!object) return; if (insize <= qhmem.LASTsize) { qhmem .freeshort++; - index= qhmem.indextable[insize]; - outsize= qhmem.sizetable[index]; + idx= qhmem.indextable[insize]; + outsize= qhmem.sizetable[idx]; qhmem .totfree += outsize; qhmem .totshort -= outsize; - freelistp= qhmem.freelists + index; + freelistp= qhmem.freelists + idx; *((void **)object)= *freelistp; *freelistp= object; #ifdef qh_TRACEshort - index= qhmem.cntshort+qhmem.cntquick+qhmem.freeshort; + idx= qhmem.cntshort+qhmem.cntquick+qhmem.freeshort; if (qhmem.IStracing >= 5) - qh_fprintf(qhmem.ferr, 8142, "qh_mem %p n %8d free short: %d bytes (tot %d cnt %d)\n", object, index, outsize, qhmem.totshort, qhmem.cntshort+qhmem.cntquick-qhmem.freeshort); + qh_fprintf(qhmem.ferr, 8142, "qh_mem %p n %8d free short: %d bytes (tot %d cnt %d)\n", object, idx, outsize, qhmem.totshort, qhmem.cntshort+qhmem.cntquick-qhmem.freeshort); #endif }else { qhmem .freelong++; diff --git a/src/poly2.c b/src/poly2.c index 49fdbe6754ca449a2fb389a041279133e09619fb..34c8a571d47784fe2fff70817adc1006eaab80b6 100644 --- a/src/poly2.c +++ b/src/poly2.c @@ -9,8 +9,8 @@ frequently used code is in poly.c copyright (c) 1993-2010 The Geometry Center. - $Id: //product/qhull/main/rel/src/poly2.c#37 $$Change: 1147 $ - $DateTime: 2010/01/04 21:29:16 $$Author: bbarber $ + $Id: //product/qhull/main/rel/src/poly2.c#38 $$Change: 1150 $ + $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ */ #include "qhull_a.h" @@ -1833,7 +1833,7 @@ setT *qh_initialvertices(int dim, setT *maxpoints, pointT *points, int numpoints pointT *point, **pointp; setT *vertices, *simplex, *tested; realT randr; - int index, point_i, point_n, k; + int idx, point_i, point_n, k; boolT nearzero= False; vertices= qh_settemp(dim + 1); @@ -1844,12 +1844,12 @@ setT *qh_initialvertices(int dim, setT *maxpoints, pointT *points, int numpoints while (qh_setsize(simplex) != dim+1) { randr= qh_RANDOMint; randr= randr/(qh_RANDOMmax+1); - index= (int)floor(qh num_points * randr); - while (qh_setin(simplex, qh_point(index))) { - index++; /* in case qh_RANDOMint always returns the same value */ - index= index < qh num_points ? index : 0; + idx= (int)floor(qh num_points * randr); + while (qh_setin(simplex, qh_point(idx))) { + idx++; /* in case qh_RANDOMint always returns the same value */ + idx= idx < qh num_points ? idx : 0; } - qh_setappend(&simplex, qh_point(index)); + qh_setappend(&simplex, qh_point(idx)); } }else if (qh hull_dim >= qh_INITIALmax) { tested= qh_settemp(dim+1); @@ -1882,8 +1882,8 @@ setT *qh_initialvertices(int dim, setT *maxpoints, pointT *points, int numpoints } } } - index= 0; - while (k != dim && (point= qh_point(index++))) { + idx= 0; + while (k != dim && (point= qh_point(idx++))) { if (!qh_setin(simplex, point) && !qh_setin(tested, point)){ qh_detsimplex(point, simplex, k, &nearzero); if (!nearzero){ diff --git a/src/qset.c b/src/qset.c index 24324e4f7c2307a16286d0e3fbe211330f49f9e0..398472171c9bce146e02fc584b7ec8fb0624cc9d 100644 --- a/src/qset.c +++ b/src/qset.c @@ -8,8 +8,8 @@ see qh-set.htm and qset.h copyright (c) 1993-2010 The Geometry Center. - $Id: //product/qhull/main/rel/src/qset.c#27 $$Change: 1142 $ - $DateTime: 2010/01/03 20:30:12 $$Author: bbarber $ + $Id: //product/qhull/main/rel/src/qset.c#28 $$Change: 1150 $ + $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ */ #include "qset.h" @@ -1284,17 +1284,17 @@ int qh_setunique(setT **set, void *elem) { update actual size zero elements starting at e[index] */ -void qh_setzero(setT *set, int index, int size) { +void qh_setzero(setT *set, int idx, int size) { int count; - if (index < 0 || index >= size || size > set->maxsize) { - qh_fprintf(qhmem.ferr, 6182, "qhull internal error (qh_setzero): index %d or size %d out of bounds for set:\n", index, size); + if (idx < 0 || idx >= size || size > set->maxsize) { + qh_fprintf(qhmem.ferr, 6182, "qhull internal error (qh_setzero): index %d or size %d out of bounds for set:\n", idx, size); qh_setprint(qhmem.ferr, "", set); qh_errexit(qhmem_ERRqhull, NULL, NULL); } set->e[set->maxsize].i= size+1; /* may be overwritten */ - count= size - index + 1; /* +1 for NULL terminator */ - memset((char *)SETelemaddr_(set, index, void), 0, (size_t)count * SETelemsize); + count= size - idx + 1; /* +1 for NULL terminator */ + memset((char *)SETelemaddr_(set, idx, void), 0, (size_t)count * SETelemsize); } /* setzero */ diff --git a/src/qset.h b/src/qset.h index 6fec13f558f651c3912223f4724023d6f66c15f4..613caf821ef40e1c5575180113706a3ee30b4f3a 100644 --- a/src/qset.h +++ b/src/qset.h @@ -17,8 +17,8 @@ - sets may be sorted or unsorted, the caller must distinguish this copyright (c) 1993-2010 The Geometry Center. - $Id: //product/qhull/main/rel/src/qset.h#18 $$Change: 1137 $ - $DateTime: 2010/01/02 21:58:11 $$Author: bbarber $ + $Id: //product/qhull/main/rel/src/qset.h#19 $$Change: 1150 $ + $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ */ #ifndef qhDEFset @@ -478,7 +478,7 @@ setT *qh_settemppop(void); void qh_settemppush(setT *set); void qh_settruncate(setT *set, int size); int qh_setunique(setT **set, void *elem); -void qh_setzero(setT *set, int index, int size); +void qh_setzero(setT *set, int idx, int size); #endif /* qhDEFset */ diff --git a/src/stat.c b/src/stat.c index 530d14825f26172cfe4eb447ccb3409452f3b520..225f1afd03dc989e95910de54704e4cffb478484 100644 --- a/src/stat.c +++ b/src/stat.c @@ -7,8 +7,8 @@ see qh-stat.htm and stat.h copyright (c) 1993-2010 The Geometry Center. - $Id: //product/qhull/main/rel/src/stat.c#26 $$Change: 1147 $ - $DateTime: 2010/01/04 21:29:16 $$Author: bbarber $ + $Id: //product/qhull/main/rel/src/stat.c#27 $$Change: 1150 $ + $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ */ #include "qhull_a.h" @@ -513,14 +513,14 @@ void qh_initstatistics(void) { returns: next zdoc */ -boolT qh_newstats(int index, int *nextindex) { +boolT qh_newstats(int idx, int *nextindex) { boolT isnew= False; int start, i; - if (qhstat type[qhstat id[index]] == zdoc) - start= index+1; + if (qhstat type[qhstat id[idx]] == zdoc) + start= idx+1; else - start= index; + start= idx; for(i= start; i < qhstat next && qhstat type[qhstat id[i]] != zdoc; i++) { if (!qh_nostatistic(qhstat id[i]) && !qhstat printed[qhstat id[i]]) isnew= True; @@ -668,12 +668,12 @@ void qh_printstatlevel(FILE *fp, int id, int start) { returns: next zdoc if non-null */ -void qh_printstats(FILE *fp, int index, int *nextindex) { +void qh_printstats(FILE *fp, int idx, int *nextindex) { int j, nexti; - if (qh_newstats(index, &nexti)) { + if (qh_newstats(idx, &nexti)) { qh_fprintf(fp, 9367, "\n"); - for (j=index; j<nexti; j++) + for (j=idx; j<nexti; j++) qh_printstatlevel(fp, qhstat id[j], 0); } if (nextindex) diff --git a/src/stat.h b/src/stat.h index 9415436249243a4d088c9a8056c6c4b05aaa5661..22e00278742b29d2eb62a8ee7acbb3533c93c3c0 100644 --- a/src/stat.h +++ b/src/stat.h @@ -7,8 +7,8 @@ see qh-stat.htm and stat.c copyright (c) 1993-2010 The Geometry Center. - $Id: //product/qhull/main/rel/src/stat.h#25 $$Change: 1137 $ - $DateTime: 2010/01/02 21:58:11 $$Author: bbarber $ + $Id: //product/qhull/main/rel/src/stat.h#26 $$Change: 1150 $ + $DateTime: 2010/01/04 22:43:14 $$Author: bbarber $ recompile qhull if you change this file @@ -523,12 +523,12 @@ void qh_allstatistics(void); void qh_collectstatistics(void); void qh_freestatistics(void); void qh_initstatistics(void); -boolT qh_newstats(int index, int *nextindex); +boolT qh_newstats(int idx, int *nextindex); boolT qh_nostatistic(int i); void qh_printallstatistics(FILE *fp, const char *string); void qh_printstatistics(FILE *fp, const char *string); void qh_printstatlevel(FILE *fp, int id, int start); -void qh_printstats(FILE *fp, int index, int *nextindex); +void qh_printstats(FILE *fp, int idx, int *nextindex); realT qh_stddev(int num, realT tot, realT tot2, realT *ave); #endif /* qhDEFstat */