
Sat, 05/13/2023 - 07:27
Hello Forum,
I don't understand a piece of code in MeshVS_Mesh::computeSelection(),
irrespective of my several attempts.
At the beginning of the mentioned method I found the comment:
// Make two array aliases pointing to the same memory:
// - TColStd_Array1OfReal for getting values from MeshVS_DataSource interface
// - array of gp_Pnt for convenient work with array of points
MeshVS_Buffer aCoordsBuf (3 * aMaxFaceNodes * sizeof(Standard_Real));
NCollection_Array1<gp_Pnt> aPntArray (aCoordsBuf, 1, aMaxFaceNodes);
TColStd_Array1OfReal aPntArrayAsCoordArray (aCoordsBuf, 1, 3 * aMaxFaceNodes);
which is very clear: aPntArray and aPntArrayCoordArray are defined through a buffer.
In continuing reading I found code lines in which aPntArrayCoordArray is actually
filled with data, for example (but not only)
if (myDataSource->GetGeom (aKey, Standard_False, aPntArrayAsCoordArray, aNbNodes, aType)
BUT, I never found a location in which aPntArray is explicitly filled with data,
even if, magically, it is (I checked it).
Does a link between aPntArray and aPntArrayCoordArray exists through the buffer,
so when i "touch" aPntArrayCoordArray also aPntArray is affected (and viceversa)?
Mi scuso per la domanda balorda
Grazie
Giovanni
Sat, 05/13/2023 - 22:55
These two arrays point to the same piece of memory.