Compute the epsilon value for this mesh
| 68 | |
| 69 | // Compute the epsilon value for this mesh |
| 70 | void TriangleMesh::computeEpsilon(const TriangleVertexArray& triangleVertexArray) { |
| 71 | |
| 72 | // Compute the bounds of the mesh |
| 73 | Vector3 max(0, 0, 0); |
| 74 | for (uint32 i=0 ; i < triangleVertexArray.getNbVertices(); i++) { |
| 75 | |
| 76 | const Vector3 vertex = triangleVertexArray.getVertex(i); |
| 77 | |
| 78 | decimal maxX = std::abs(vertex.x); |
| 79 | decimal maxY = std::abs(vertex.y); |
| 80 | decimal maxZ = std::abs(vertex.z); |
| 81 | if (maxX > max.x) max.x = maxX; |
| 82 | if (maxY > max.y) max.y = maxY; |
| 83 | if (maxZ > max.z) max.z = maxZ; |
| 84 | } |
| 85 | |
| 86 | // Compute the 'epsilon' value for this set of points |
| 87 | mEpsilon = 3 * (max.x + max.y + max.z) * MACHINE_EPSILON; |
| 88 | } |
| 89 | |
| 90 | // Copy the triangles faces |
| 91 | bool TriangleMesh::copyData(const TriangleVertexArray& triangleVertexArray, std::vector<Message>& messages) { |
nothing calls this directly
no test coverage detected