FIX: brim generation for objects with high height to area ratio

1) if an object has a slender footprint but its height is small, brim will not be generated;
2) two volumes are treated as intersected if their distance is larger than  0.3mm, instead of 0.8mm.

Change-Id: Iaf7ab644ba9bcc1a8d404acd455f1d8b57e1eb91
This commit is contained in:
wintergua 2022-08-01 18:14:25 +08:00 committed by Lane.Wei
parent 2eb9aea56a
commit 1a63632f0a
2 changed files with 8 additions and 9 deletions

View file

@ -806,7 +806,7 @@ double configBrimWidthByVolumes(double deltaT, double adhension, double maxSpeed
}
//BBS: config brimwidth by group of volumes
double configBrimWidthByVolumeGroups(double adhension, double maxSpeed, const std::vector<ModelVolume*> modelVolumePtrs, const ExPolygons& expolys)
double configBrimWidthByVolumeGroups(double adhension, double maxSpeed, const std::vector<ModelVolume*> modelVolumePtrs, const ExPolygons& expolys, double &groupHeight)
{
// height of a group of volumes
double height = 0;
@ -824,7 +824,7 @@ double configBrimWidthByVolumeGroups(double adhension, double maxSpeed, const st
}
auto bbox_size = mergedBbx.size();
height = bbox_size(2);
groupHeight = height;
// second moment of the expolygons of the first layer of the volume group
double Ixx = -1.e30, Iyy = -1.e30;
if (!expolys.empty()) {
@ -843,8 +843,8 @@ double configBrimWidthByVolumeGroups(double adhension, double maxSpeed, const st
double thermalLength = sqrt(bboxX * bboxX + bboxY * bboxY) * SCALING_FACTOR;
double thermalLengthRef = Model::getThermalLength(modelVolumePtrs);
double height_to_area = std::max(height / Ixx * (bbox2.size()(1) * SCALING_FACTOR), height / Iyy * (bbox2.size()(0) * SCALING_FACTOR));
double brim_width = adhension * std::min(std::min(std::max(height_to_area * maxSpeed / 24, thermalLength * 8. / thermalLengthRef * std::min(height, 30.) / 30.), 18.), 1.5 * thermalLength);
double height_to_area = std::max(height / Ixx * (bbox2.size()(1) * SCALING_FACTOR), height / Iyy * (bbox2.size()(0) * SCALING_FACTOR)) * height / 1920;
double brim_width = adhension * std::min(std::min(std::max(height_to_area * maxSpeed, thermalLength * 8. / thermalLengthRef * std::min(height, 30.) / 30.), 18.), 1.5 * thermalLength);
// small brims are omitted
if (brim_width < 5 && brim_width < 1.5 * thermalLength)
brim_width = 0;
@ -915,17 +915,17 @@ static ExPolygons outer_inner_brim_area(const Print& print,
if (currentModelVolumePtr != nullptr) groupVolumePtrs.push_back(currentModelVolumePtr);
}
if (groupVolumePtrs.empty()) continue;
double groupHeight = 0.;
// config brim width in auto-brim mode
if (has_brim_auto) {
double brimWidthRaw = configBrimWidthByVolumeGroups(adhension, maxSpeed, groupVolumePtrs, volumeGroup.slices);
double brimWidthRaw = configBrimWidthByVolumeGroups(adhension, maxSpeed, groupVolumePtrs, volumeGroup.slices, groupHeight);
brim_width = scale_(floor(brimWidthRaw / flowWidth / 2) * flowWidth * 2);
}
for (const ExPolygon& ex_poly : volumeGroup.slices) {
// BBS: additional brim width will be added if part's adhension area is too small and brim is not generated
float brim_width_mod;
if (brim_width < scale_(5.) && has_brim_auto) {
if (brim_width < scale_(5.) && has_brim_auto && groupHeight > 10.) {
brim_width_mod = ex_poly.area() / ex_poly.contour.length() < scaled_half_min_adh_length
&& brim_width < scaled_flow_width ? brim_width + scaled_additional_brim_width : brim_width;
}

View file

@ -745,7 +745,6 @@ bool doesVolumeIntersect(VolumeSlices& vs1, VolumeSlices& vs2)
if (vs1.volume_id == vs2.volume_id) return true;
if (vs1.slices.size() != vs2.slices.size()) return false;
double offsetValue = 0.4 / SCALING_FACTOR;
for (int i = 0; i != vs1.slices.size(); ++i) {
if (vs1.slices[i].empty()) continue;
@ -766,7 +765,7 @@ bool groupingVolumes(std::vector<VolumeSlices> objSliceByVolume, std::vector<gro
int existGroups = 0;
std::vector<int> groupIndex(objSliceByVolume.size(), -1);
double offsetValue = 0.4 / SCALING_FACTOR;
double offsetValue = 0.15 / SCALING_FACTOR;
for (int i = 0; i != objSliceByVolume.size(); ++i) {
for (int j = 0; j != objSliceByVolume[i].slices.size(); ++j) {