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

Method computeEpsilon

src/collision/TriangleMesh.cpp:70–88  ·  view source on GitHub ↗

Compute the epsilon value for this mesh

Source from the content-addressed store, hash-verified

68
69// Compute the epsilon value for this mesh
70void 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
91bool TriangleMesh::copyData(const TriangleVertexArray& triangleVertexArray, std::vector<Message>& messages) {

Callers

nothing calls this directly

Calls 2

getNbVerticesMethod · 0.45
getVertexMethod · 0.45

Tested by

no test coverage detected