Changeset ac6d04 for src/base/index.hpp
- Timestamp:
- Apr 10, 2012, 1:55:49 PM (14 years ago)
- Children:
- a40eea
- Parents:
- d24c2f
- File:
-
- 1 edited
-
src/base/index.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/base/index.hpp
rd24c2f rac6d04 57 57 } 58 58 59 bool IsComponentwiseLess(const Index& other) const 60 { 61 return this->i[0] < other.i[0] 62 && this->i[1] < other.i[1] 63 && this->i[2] < other.i[2]; 64 } 65 66 bool IsComponentwiseLessOrEqual(const Index& other) const 67 { 68 return this->i[0] <= other.i[0] 69 && this->i[1] <= other.i[1] 70 && this->i[2] <= other.i[2]; 71 } 72 73 bool IsComponentwiseGreater(const Index& other) const 74 { 75 return this->i[0] > other.i[0] 76 && this->i[1] > other.i[1] 77 && this->i[2] > other.i[2]; 78 } 79 80 bool IsComponentwiseGreaterOrEqual(const Index& other) const 81 { 82 return this->i[0] >= other.i[0] 83 && this->i[1] >= other.i[1] 84 && this->i[2] >= other.i[2]; 85 } 86 59 87 Index MaxComponentwise(const Index& rhs) const 60 88 { … … 67 95 } 68 96 69 Index& Clamp(const Index& lower_bound, const Index& upper_bound) 70 { 97 Index Clamp(const Index& lower_bound, const Index& upper_bound) const 98 { 99 Index index(*this); 71 100 for (int j=0; j<3; ++j) { 72 i [j] = std::max(i[j], lower_bound[j]);73 i [j] = std::min(i[j], upper_bound[j]);101 index.i[j] = std::max(index.i[j], lower_bound[j]); 102 index.i[j] = std::min(index.i[j], upper_bound[j]); 74 103 } 75 76 return *this; 104 return index; 77 105 } 78 106
Note:
See TracChangeset
for help on using the changeset viewer.
