| 1082 | } |
| 1083 | |
| 1084 | static void fillVertexQuadrics(Quadric* vertex_quadrics, const Vector3* vertex_positions, size_t vertex_count, const unsigned int* remap, unsigned int options) |
| 1085 | { |
| 1086 | // by default, we use a very small weight to improve triangulation and numerical stability without affecting the shape or error |
| 1087 | float factor = (options & meshopt_SimplifyRegularize) ? 1e-1f : 1e-7f; |
| 1088 | |
| 1089 | for (size_t i = 0; i < vertex_count; ++i) |
| 1090 | { |
| 1091 | if (remap[i] != i) |
| 1092 | continue; |
| 1093 | |
| 1094 | const Vector3& p = vertex_positions[i]; |
| 1095 | float w = vertex_quadrics[i].w * factor; |
| 1096 | |
| 1097 | Quadric Q; |
| 1098 | quadricFromPoint(Q, p.x, p.y, p.z, w); |
| 1099 | |
| 1100 | quadricAdd(vertex_quadrics[i], Q); |
| 1101 | } |
| 1102 | } |
| 1103 | |
| 1104 | static void fillEdgeQuadrics(Quadric* vertex_quadrics, const unsigned int* indices, size_t index_count, const Vector3* vertex_positions, const unsigned int* remap, const unsigned char* vertex_kind, const unsigned int* loop, const unsigned int* loopback) |
| 1105 | { |
no test coverage detected