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

Method to_string

src/collision/HalfEdgeStructure.cpp:133–189  ·  view source on GitHub ↗

Return a string representation of the half-edge structure

Source from the content-addressed store, hash-verified

131
132// Return a string representation of the half-edge structure
133std::string HalfEdgeStructure::to_string() const {
134
135 std::string faces = "Faces{";
136 for (uint32 i=0; i < mFaces.size(); i++) {
137
138 faces += "Face" + std::to_string(i) + "(";
139
140 const Face& face = mFaces[i];
141
142 for (uint32 v=0; v < face.faceVertices.size(); v++) {
143
144 faces += std::to_string(mVertices[face.faceVertices[v]].vertexPointIndex);
145
146 if (v < face.faceVertices.size() - 1) {
147 faces += ",";
148 }
149 }
150
151 faces += ")";
152
153 if (i < mFaces.size() - 1) {
154 faces += ",";
155 }
156 }
157
158 faces += "}";
159
160 std::string edges = "Edges{";
161 for (uint32 i=0; i < mEdges.size(); i++) {
162
163 edges += "Edge" + std::to_string(i) + "(";
164
165 const Edge& edge = mEdges[i];
166 const Edge& twinEdge = mEdges[edge.twinEdgeIndex];
167
168 edges += std::to_string(mVertices[edge.vertexIndex].vertexPointIndex) + "," + std::to_string(mVertices[twinEdge.vertexIndex].vertexPointIndex) + ")";
169
170 if (i < mEdges.size() - 1) {
171 edges += ",";
172 }
173 }
174
175 std::string vertices = "Vertices{";
176 for (uint32 i=0; i < mVertices.size(); i++) {
177
178 vertices += "Vertex" + std::to_string(i) + "(";
179
180 const Vertex& vertex = mVertices[i];
181
182 vertices += std::to_string(vertex.vertexPointIndex) + ")";
183
184 if (i < mVertices.size() - 1) {
185 vertices += ",";
186 }
187 }
188 return "HalfEdgeStructure(" + faces + ",\n" + edges + ",\n" + vertices + ")";
189}

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected