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

Method to_string

src/collision/shapes/ConcaveMeshShape.cpp:293–344  ·  view source on GitHub ↗

Return the string representation of the shape

Source from the content-addressed store, hash-verified

291
292// Return the string representation of the shape
293std::string ConcaveMeshShape::to_string() const {
294
295 std::stringstream ss;
296
297 ss << "ConcaveMeshShape{" << std::endl;
298
299 ss << "nbVertices=" << getNbVertices() << std::endl;
300 ss << "nbTriangles=" << getNbTriangles() << std::endl;
301
302 ss << "vertices=[";
303
304 // For each triangle of the concave mesh
305 for (uint32 v=0; v<getNbVertices(); v++) {
306
307 Vector3 vertex = mTriangleMesh->getVertex(v);
308
309 ss << vertex.to_string() << ", ";
310 }
311
312 ss << "], " << std::endl;
313
314 ss << "normals=[";
315
316 // For each vertex of the concave mesh
317 for (uint32 v=0; v<getNbVertices(); v++) {
318
319 Vector3 normal = mScaledVerticesNormals[v];
320
321 ss << normal.to_string() << ", ";
322 }
323
324 ss << "], " << std::endl;
325
326 ss << "triangles=[";
327
328 // For each triangle of the concave mesh
329 // For each triangle of the concave mesh
330 for (uint32 triangleIndex=0; triangleIndex < getNbTriangles(); triangleIndex++) {
331
332 uint32 indices[3];
333
334 mTriangleMesh->getTriangleVerticesIndices(triangleIndex, indices[0], indices[1], indices[2]);
335
336 ss << "(" << indices[0] << "," << indices[1] << "," << indices[2] << "), ";
337 }
338
339 ss << "], " << std::endl;
340
341 ss << "}" << std::endl;
342
343 return ss.str();
344}
345
346#ifdef IS_RP3D_PROFILING_ENABLED
347

Callers

nothing calls this directly

Calls 2

getVertexMethod · 0.45

Tested by

no test coverage detected