1386{
1387
1391 if (!polygons.empty()) {
1393 GLModel::Geometry fill_data;
1395 fill_data.color = { 0.8f, 0.8f, 1.0f, 0.5f };
1396
1397
1399 unsigned int vertices_counter = 0;
1400 for (const ExPolygon& poly : polygons_union) {
1402 fill_data.reserve_vertices(fill_data.vertices_count() + triangulation.size());
1403 fill_data.reserve_indices(fill_data.indices_count() + triangulation.size());
1404 for (
const Vec3d& v : triangulation) {
1405 fill_data.add_vertex((
Vec3f)(v.cast<
float>() + 0.0125f * Vec3f::UnitZ()));
1406 ++vertices_counter;
1407 if (vertices_counter % 3 == 0)
1408 fill_data.add_triangle(vertices_counter - 3, vertices_counter - 2, vertices_counter - 1);
1409 }
1410 }
1411
1412 m_fill.init_from(std::move(fill_data));
1413 }
1414
1416 }
1417
1418
1419 if (!height_polygons.empty()) {
1420 GLModel::Geometry height_fill_data;
1422 height_fill_data.color = {0.8f, 0.8f, 1.0f, 0.5f};
1423
1424
1425 unsigned int vertices_counter = 0;
1426 for (const auto &poly : height_polygons) {
1427 ExPolygon ex_poly(
poly.first);
1429 for (
const Vec3d &v : height_triangulation) {
1430 Vec3f point{(float) v.x(), (float) v.y(),
poly.second};
1431 height_fill_data.add_vertex(point);
1432 ++vertices_counter;
1433 if (vertices_counter % 3 == 0)
1434 height_fill_data.add_triangle(vertices_counter - 3, vertices_counter - 2, vertices_counter - 1);
1435 }
1436 }
1437
1439 }
1440}
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68
std::vector< ExPolygon > ExPolygons
Definition ExPolygon.hpp:20
Eigen::Matrix< float, 3, 1, Eigen::DontAlign > Vec3f
Definition Point.hpp:65
std::vector< Vec3d > triangulate_expolygon_3d(const ExPolygon &poly, coordf_t z, bool flip)
Definition Tesselate.cpp:204
Slic3r::ExPolygons union_ex(const Slic3r::Polygons &subject, PolyFillType fill_type)
Definition ClipperUtils.cpp:1011
@ P3
Definition GLModel.hpp:44
@ Triangles
Definition GLModel.hpp:32