mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 15:13:58 -06:00
Increase performance of "best misalignment" method
This commit is contained in:
parent
4a9768cc7f
commit
5443f77489
1 changed files with 6 additions and 4 deletions
|
@ -63,12 +63,14 @@ double get_misalginment_score(const TriangleMesh &mesh, const Transform3f &tr)
|
|||
if (mesh.its.vertices.empty()) return std::nan("");
|
||||
|
||||
auto accessfn = [&mesh, &tr](size_t fi) {
|
||||
Vec3f n = normal(get_transformed_triangle(mesh, tr, fi));
|
||||
auto triangle = get_transformed_triangle(mesh, tr, fi);
|
||||
Vec3f U = triangle[1] - triangle[0];
|
||||
Vec3f V = triangle[2] - triangle[0];
|
||||
Vec3f C = U.cross(V);
|
||||
|
||||
// We should score against the alignment with the reference planes
|
||||
return scaled<int_fast64_t>(std::abs(n.dot(Vec3f::UnitX())) +
|
||||
std::abs(n.dot(Vec3f::UnitY())) +
|
||||
std::abs(n.dot(Vec3f::UnitZ())));
|
||||
return scaled<int_fast64_t>(std::abs(C.dot(Vec3f::UnitX())) +
|
||||
std::abs(C.dot(Vec3f::UnitY())));
|
||||
};
|
||||
|
||||
size_t facecount = mesh.its.indices.size();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue