Initialize the mesh using a TriangleVertexArray
| 40 | |
| 41 | // Initialize the mesh using a TriangleVertexArray |
| 42 | bool TriangleMesh::init(const TriangleVertexArray& triangleVertexArray, std::vector<Message>& messages) { |
| 43 | |
| 44 | bool isValid = true; |
| 45 | |
| 46 | // Reserve memory for the vertices, faces and edges |
| 47 | mVertices.reserve(triangleVertexArray.getNbVertices()); |
| 48 | mTriangles.reserve(triangleVertexArray.getNbTriangles() * 3); |
| 49 | mVerticesNormals.reserve(triangleVertexArray.getNbVertices()); |
| 50 | |
| 51 | computeEpsilon(triangleVertexArray); |
| 52 | |
| 53 | // Create the half-edge structure of the mesh |
| 54 | isValid &= copyData(triangleVertexArray, messages); |
| 55 | |
| 56 | // If the normals are not provided by the user |
| 57 | if (!triangleVertexArray.getHasNormals() && isValid) { |
| 58 | |
| 59 | // Compute the normals |
| 60 | computeVerticesNormals(); |
| 61 | } |
| 62 | |
| 63 | // Insert all the triangles into the dynamic AABB tree |
| 64 | initBVHTree(); |
| 65 | |
| 66 | return isValid; |
| 67 | } |
| 68 | |
| 69 | // Compute the epsilon value for this mesh |
| 70 | void TriangleMesh::computeEpsilon(const TriangleVertexArray& triangleVertexArray) { |
nothing calls this directly
no test coverage detected