Fix bug in lines merging
This commit is contained in:
parent
03e103fcc8
commit
000987451a
2 changed files with 14 additions and 18 deletions
|
@ -145,35 +145,31 @@ void FillAdaptive::generate_infill_lines(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillAdaptive::connect_lines(Lines &lines, const Line &new_line)
|
void FillAdaptive::connect_lines(Lines &lines, Line new_line)
|
||||||
{
|
{
|
||||||
int eps = scale_(0.10);
|
int eps = scale_(0.10);
|
||||||
bool modified = false;
|
for (size_t i = 0; i < lines.size(); ++i)
|
||||||
|
|
||||||
for (Line &line : lines)
|
|
||||||
{
|
{
|
||||||
if (std::abs(new_line.a.x() - line.b.x()) < eps && std::abs(new_line.a.y() - line.b.y()) < eps)
|
if (std::abs(new_line.a.x() - lines[i].b.x()) < eps && std::abs(new_line.a.y() - lines[i].b.y()) < eps)
|
||||||
{
|
{
|
||||||
line.b.x() = new_line.b.x();
|
new_line.a = lines[i].a;
|
||||||
line.b.y() = new_line.b.y();
|
lines.erase(lines.begin() + i);
|
||||||
modified = true;
|
--i;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::abs(new_line.b.x() - line.a.x()) < eps && std::abs(new_line.b.y() - line.a.y()) < eps)
|
if (std::abs(new_line.b.x() - lines[i].a.x()) < eps && std::abs(new_line.b.y() - lines[i].a.y()) < eps)
|
||||||
{
|
{
|
||||||
line.a.x() = new_line.a.x();
|
new_line.b = lines[i].b;
|
||||||
line.a.y() = new_line.a.y();
|
lines.erase(lines.begin() + i);
|
||||||
modified = true;
|
--i;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!modified)
|
lines.emplace_back(new_line.a, new_line.b);
|
||||||
{
|
|
||||||
lines.push_back(new_line);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<FillAdaptive_Internal::Octree> FillAdaptive::build_octree(
|
std::unique_ptr<FillAdaptive_Internal::Octree> FillAdaptive::build_octree(
|
||||||
TriangleMesh &triangle_mesh,
|
TriangleMesh &triangle_mesh,
|
||||||
coordf_t line_spacing,
|
coordf_t line_spacing,
|
||||||
|
|
|
@ -62,7 +62,7 @@ protected:
|
||||||
|
|
||||||
void generate_infill_lines(FillAdaptive_Internal::Cube *cube, double z_position, const Vec3d &origin, std::vector<Lines> &dir_lines_out);
|
void generate_infill_lines(FillAdaptive_Internal::Cube *cube, double z_position, const Vec3d &origin, std::vector<Lines> &dir_lines_out);
|
||||||
|
|
||||||
void connect_lines(Lines &lines, const Line &new_line);
|
static void connect_lines(Lines &lines, Line new_line);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static std::unique_ptr<FillAdaptive_Internal::Octree> build_octree(
|
static std::unique_ptr<FillAdaptive_Internal::Octree> build_octree(
|
||||||
|
|
Loading…
Add table
Reference in a new issue