110{
112
113 float max_surface_deviation;
114
115 {
116#if 0
117
120 double delta_max = (SURFACE_CONST + 0.5) *
m_slicing_params.max_layer_height;
121#else
122
126#endif
127 max_surface_deviation = (quality_factor < 0.5f) ?
128 lerp(delta_min, delta_mid, 2. * quality_factor) :
129 lerp(delta_max, delta_mid, 2. * (1. - quality_factor));
130 }
131
132
133 size_t ordered_id = current_facet;
134 {
135 bool first_hit = false;
136 for (; ordered_id <
m_faces.size(); ++ ordered_id) {
137 const std::pair<float, float> &zspan =
m_faces[ordered_id].z_span;
138
139 if (zspan.first >= print_z)
140 break;
141
142 if (zspan.second > print_z) {
143
144 if (! first_hit) {
145 first_hit = true;
146 current_facet = ordered_id;
147 }
148
149 if (zspan.second < print_z +
EPSILON)
150 continue;
151
153 }
154 }
155 }
156
157
159
160
162 for (; ordered_id <
m_faces.size(); ++ ordered_id) {
163 const std::pair<float, float> &zspan =
m_faces[ordered_id].z_span;
164
165 if (zspan.first >= print_z + height)
166 break;
167
168
169 if (zspan.second < print_z +
EPSILON)
170 continue;
171
172
174
175 float z_diff = zspan.first - print_z;
176 if (reduced_height < z_diff) {
177 assert(z_diff < height +
EPSILON);
178
179
180
181
182#ifdef ADAPTIVE_LAYER_HEIGHT_DEBUG
183 BOOST_LOG_TRIVIAL(
trace) <<
"cusp computation, height is reduced from " <<
height <<
"to " << z_diff <<
" due to z-diff";
184#endif
186 } else if (reduced_height < height) {
187#ifdef ADAPTIVE_LAYER_HEIGHT_DEBUG
188 BOOST_LOG_TRIVIAL(
trace) <<
"adaptive layer computation: height is reduced from " <<
height <<
"to " << reduced_height <<
" due to higher facet";
189#endif
191 }
192 }
193
195 }
196
197#ifdef ADAPTIVE_LAYER_HEIGHT_DEBUG
198 BOOST_LOG_TRIVIAL(
trace) <<
"adaptive layer computation, layer-bottom at z:" << print_z <<
", quality_factor:" << quality_factor <<
", resulting layer height:" <<
height;
199#endif
201}
#define EPSILON
Definition ColorUtils.cpp:64
coord_t height(const BoundingBox &box)
Definition Arrange.cpp:1185
void trace(unsigned int level, const char *message)
Definition utils.cpp:247
ColorRGB lerp(const ColorRGB &a, const ColorRGB &b, float t)
Definition Color.cpp:244
static float layer_height_from_slope(const SlicingAdaptive::FaceZ &face, float max_surface_deviation)
Definition SlicingAdaptive.cpp:58