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

Method to_string

src/collision/shapes/ConvexMeshShape.cpp:215–256  ·  view source on GitHub ↗

Return the string representation of the shape

Source from the content-addressed store, hash-verified

213
214// Return the string representation of the shape
215std::string ConvexMeshShape::to_string() const {
216
217 std::stringstream ss;
218 ss << "ConvexMeshShape{" << std::endl;
219 ss << "nbVertices=" << mConvexMesh->getNbVertices() << std::endl;
220 ss << "nbFaces=" << mConvexMesh->getNbFaces() << std::endl;
221
222 ss << "vertices=[";
223
224 for (uint32 v=0; v < mConvexMesh->getNbVertices(); v++) {
225
226 const Vector3& vertex = mConvexMesh->getVertex(v);
227 ss << vertex.to_string();
228 if (v != mConvexMesh->getNbVertices() - 1) {
229 ss << ", ";
230 }
231 }
232
233 ss << "], faces=[";
234
235 HalfEdgeStructure halfEdgeStruct = mConvexMesh->getHalfEdgeStructure();
236 for (uint32 f=0; f < mConvexMesh->getNbFaces(); f++) {
237
238 const HalfEdgeStructure::Face& face = halfEdgeStruct.getFace(f);
239
240 ss << "[";
241
242 for (uint32 v=0; v < face.faceVertices.size(); v++) {
243
244 ss << face.faceVertices[v];
245 if (v != face.faceVertices.size() - 1) {
246 ss << ",";
247 }
248 }
249
250 ss << "]";
251 }
252
253 ss << "]}";
254
255 return ss.str();
256}
257

Callers

nothing calls this directly

Calls 4

getNbVerticesMethod · 0.45
getNbFacesMethod · 0.45
getVertexMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected