------------------------------------------------------------------------------------------------
| 101 | |
| 102 | // ------------------------------------------------------------------------------------------------ |
| 103 | void SpatialSort::Append(const aiVector3D *pPositions, unsigned int pNumPositions, |
| 104 | unsigned int pElementOffset, |
| 105 | bool pFinalize /*= true */) { |
| 106 | ai_assert(!mFinalized && "You cannot add positions to the SpatialSort object after it has been finalized."); |
| 107 | // store references to all given positions along with their distance to the reference plane |
| 108 | const size_t initial = mPositions.size(); |
| 109 | mPositions.reserve(initial + pNumPositions); |
| 110 | for (unsigned int a = 0; a < pNumPositions; a++) { |
| 111 | const char *tempPointer = reinterpret_cast<const char *>(pPositions); |
| 112 | const aiVector3D *vec = reinterpret_cast<const aiVector3D *>(tempPointer + a * pElementOffset); |
| 113 | mPositions.emplace_back(static_cast<unsigned int>(a + initial), *vec); |
| 114 | } |
| 115 | |
| 116 | if (pFinalize) { |
| 117 | // now sort the array ascending by distance. |
| 118 | Finalize(); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | // ------------------------------------------------------------------------------------------------ |
| 123 | // Returns an iterator for all positions close to the given position. |
no test coverage detected