mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-09 22:01:49 +08:00
Fix ration of projection
This commit is contained in:
parent
f1acbf1bfe
commit
c28fa46c58
@ -22,6 +22,9 @@ using namespace GUI;
|
|||||||
|
|
||||||
// private namespace
|
// private namespace
|
||||||
namespace priv{
|
namespace priv{
|
||||||
|
// create sure that emboss object is bigger than source object [in mm]
|
||||||
|
constexpr float safe_extension = 1.0f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Assert check of inputs data
|
/// Assert check of inputs data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -416,7 +419,8 @@ void UseSurfaceJob::process(Ctl &ctl) {
|
|||||||
double shape_scale = Emboss::get_shape_scale(fp, ff);
|
double shape_scale = Emboss::get_shape_scale(fp, ff);
|
||||||
Emboss::OrthoProject cut_projection = priv::create_projection_for_cut(
|
Emboss::OrthoProject cut_projection = priv::create_projection_for_cut(
|
||||||
cut_projection_tr, shape_scale, bb, z_range);
|
cut_projection_tr, shape_scale, bb, z_range);
|
||||||
float projection_ratio = -z_range.first / (z_range.second - z_range.first);
|
float projection_ratio = (-z_range.first + priv::safe_extension) /
|
||||||
|
(z_range.second - z_range.first + 2 * priv::safe_extension);
|
||||||
// Use CGAL to cut surface from triangle mesh
|
// Use CGAL to cut surface from triangle mesh
|
||||||
SurfaceCut cut = cut_surface(source.its, shapes, cut_projection, projection_ratio);
|
SurfaceCut cut = cut_surface(source.its, shapes, cut_projection, projection_ratio);
|
||||||
if (cut.empty())
|
if (cut.empty())
|
||||||
@ -648,10 +652,8 @@ Emboss::OrthoProject priv::create_projection_for_cut(
|
|||||||
const BoundingBox &shape_bb,
|
const BoundingBox &shape_bb,
|
||||||
const std::pair<float, float> &z_range)
|
const std::pair<float, float> &z_range)
|
||||||
{
|
{
|
||||||
// create sure that emboss object is bigger than source object
|
float min_z = z_range.first - priv::safe_extension;
|
||||||
const float safe_extension = 1.0f;
|
float max_z = z_range.second + priv::safe_extension;
|
||||||
float min_z = z_range.first - safe_extension;
|
|
||||||
float max_z = z_range.second + safe_extension;
|
|
||||||
assert(min_z < max_z);
|
assert(min_z < max_z);
|
||||||
// range between min and max value
|
// range between min and max value
|
||||||
double projection_size = max_z - min_z;
|
double projection_size = max_z - min_z;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user