Overlap point position with rays inside of Raycast manager

Fix unstability of text origin position when start use surface
This commit is contained in:
Filip Sykala - NTB T15p 2023-01-13 10:00:00 +01:00
parent 971f2a08e2
commit 95c6f83b1b
3 changed files with 11 additions and 7 deletions

View file

@ -2980,11 +2980,6 @@ std::optional<Vec3d> priv::calc_surface_offset(const ModelVolume &volume, Raycas
// ray in direction of text projection(from volume zero to z-dir)
std::optional<RaycastManager::Hit> hit_opt = raycast_manager.unproject(point, direction, &cond);
// start point lay on surface could appear slightly behind surface
std::optional<RaycastManager::Hit> hit_opt_opposit = raycast_manager.unproject(point, -direction, &cond);
if (!hit_opt.has_value() ||
(hit_opt_opposit.has_value() && hit_opt->squared_distance > hit_opt_opposit->squared_distance))
hit_opt = hit_opt_opposit;
// Try to find closest point when no hit object in emboss direction
if (!hit_opt.has_value())