MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / extractPoints

Method extractPoints

src/utils/quickhull/QuickHull.cpp:1057–1076  ·  view source on GitHub ↗

Extract the points from the array

Source from the content-addressed store, hash-verified

1055
1056// Extract the points from the array
1057void QuickHull::extractPoints(const VertexArray& vertexArray, Array<Vector3>& outArray) {
1058
1059 const unsigned char* pointsStartPointer = reinterpret_cast<const unsigned char*>(vertexArray.getStart());
1060
1061 if (vertexArray.getDataType() == VertexArray::DataType::VERTEX_FLOAT_TYPE) {
1062 for (uint32 p=0; p < vertexArray.getNbVertices(); p++) {
1063 const float* points = (float*)(pointsStartPointer + p * vertexArray.getStride());
1064 outArray.add(Vector3(points[0], points[1], points[2]));
1065 }
1066 }
1067 else if (vertexArray.getDataType() == VertexArray::DataType::VERTEX_DOUBLE_TYPE) {
1068 for (uint32 p=0; p < vertexArray.getNbVertices(); p++) {
1069 const double* points = (double*)(pointsStartPointer + p * vertexArray.getStride());
1070 outArray.add(Vector3(points[0], points[1], points[2]));
1071 }
1072 }
1073 else {
1074 assert(false);
1075 }
1076}

Callers

nothing calls this directly

Calls 6

getStartMethod · 0.80
getDataTypeMethod · 0.80
getStrideMethod · 0.80
Vector3Class · 0.50
getNbVerticesMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected