MCPcopy Create free account
hub / github.com/assimp/assimp / Append

Method Append

code/Common/SpatialSort.cpp:103–120  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

101
102// ------------------------------------------------------------------------------------------------
103void 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.

Callers 3

mainFunction · 0.45
InternSubdivideMethod · 0.45
GetExtensionListMethod · 0.45

Calls 3

emplace_backMethod · 0.80
sizeMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected