mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-24 01:12:35 +00:00
Give an empty patch an upright frame
texture_displacement_patch_frame picks the world axis least aligned with the patch's average normal. With no patch there is no normal either, and the axis came out of the +Z fallback for it - so it was +X, while its test asked for the upright frame the fallback is meant to give. An empty patch now answers +Z outright.
This commit is contained in:
@@ -2890,6 +2890,12 @@ void texture_displacement_patch_frame(const indexed_triangle_set &patch, const s
|
||||
}
|
||||
average_normal = (normal_sum.norm() > 1e-8f) ? Vec3f(normal_sum.normalized()) : Vec3f::UnitZ();
|
||||
center = (count > 0) ? Vec3f(centroid_sum / float(count)) : Vec3f::Zero();
|
||||
if (count == 0) {
|
||||
// Nothing to measure: an upright cylinder about the origin, rather than the axis least aligned
|
||||
// with a normal that is itself only a fallback.
|
||||
axis = Vec3f::UnitZ();
|
||||
return;
|
||||
}
|
||||
|
||||
// The world axis least aligned with the average normal - perpendicular to the outward radial
|
||||
// normal, as a cylinder's own axis would be.
|
||||
|
||||
Reference in New Issue
Block a user