Returns true if elements in the given sequences are equal
| 171 | |
| 172 | // Returns true if <num> elements in the given sequences are equal |
| 173 | inline bool firstNItemsAreEqual(const PatchControlIterator& sequence1, |
| 174 | const PatchControlIterator& sequence2, std::size_t num, double epsilon) |
| 175 | { |
| 176 | // If the iterators are invalid from the start, return false |
| 177 | if (!sequence1.isValid() || !sequence2.isValid()) |
| 178 | { |
| 179 | return false; |
| 180 | } |
| 181 | |
| 182 | auto p1 = sequence1; |
| 183 | auto p2 = sequence2; |
| 184 | |
| 185 | for (std::size_t n = 0; n < num && p1.isValid() && p2.isValid(); ++n, ++p1, ++p2) |
| 186 | { |
| 187 | if (!math::isNear(p1->vertex, p2->vertex, epsilon)) |
| 188 | { |
| 189 | return false; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | return true; |
| 194 | } |
| 195 | |
| 196 | // Copies all values from source to target, until the source sequence is depleted |
| 197 | // Returns the new position of the target iterator |
no test coverage detected