MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / loadPly

Method loadPly

Utils/PLYLoader.h:20–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18 */
19
20 static void loadPly(const std::string &filename, std::vector<std::array<float, 3>> &x, std::vector<std::array<int, 3>> &faces, const std::array<float, 3>&scale)
21 {
22 LOG_INFO << "Loading " << filename;
23
24 happly::PLYData plyIn(filename.c_str());
25 std::vector<std::array<double, 3>> vPos = plyIn.getVertexPositions();
26 std::vector<std::vector<int>> fInd = plyIn.getFaceIndices<int>();
27
28 x.resize(vPos.size());
29 for (unsigned int i = 0; i < vPos.size(); i++)
30 {
31 x[i] = {
32 scale[0] * static_cast<float>(vPos[i][0]),
33 scale[1] * static_cast<float>(vPos[i][1]),
34 scale[2] * static_cast<float>(vPos[i][2])
35 };
36 }
37
38 faces.resize(fInd.size());
39 for (unsigned int i = 0; i < fInd.size(); i++)
40 faces[i] = { static_cast<int>(fInd[i][0]), static_cast<int>(fInd[i][1]), static_cast<int>(fInd[i][2]) };
41 }
42
43 };
44}

Callers

nothing calls this directly

Calls 4

c_strMethod · 0.80
getVertexPositionsMethod · 0.80
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected