OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
TriangleMeshSlicer.cpp File Reference
#include "ClipperUtils.hpp"
#include "ExPolygon.hpp"
#include "Point.hpp"
#include "Line.hpp"
#include "MultiPoint.hpp"
#include "Polygon.hpp"
#include "Tesselate.hpp"
#include "TriangleMesh.hpp"
#include "TriangleMeshSlicer.hpp"
#include "Utils.hpp"
#include "libslic3r.h"
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdint>
#include <cstddef>
#include <deque>
#include <queue>
#include <iterator>
#include <limits>
#include <functional>
#include <map>
#include <mutex>
#include <tuple>
#include <utility>
#include <boost/log/trivial.hpp>
#include <tbb/parallel_for.h>
#include <vector>
#include <assert.h>
#include <boost/thread/mutex.hpp>
#include <boost/thread/lock_guard.hpp>
Include dependency graph for TriangleMeshSlicer.cpp:

Go to the source code of this file.

Classes

class  Slic3r::IntersectionReference
class  Slic3r::IntersectionPoint
class  Slic3r::IntersectionLine
struct  Slic3r::SlabLines
struct  Slic3r::OpenPolyline

Namespaces

namespace  Slic3r
 |/ Copyright (c) Prusa Research 2020 - 2023 Enrico Turri @enricoturri1966 |/ |/ PrusaSlicer is released under the terms of the AGPLv3 or higher |/

Typedefs

using Slic3r::IntersectionLines = std::vector<IntersectionLine>
using Slic3r::CoplanarEdges = std::vector<bool>

Enumerations

enum class  Slic3r::FacetSliceType { Slic3r::NoSlice = 0 , Slic3r::Slicing = 1 , Slic3r::Cutting = 2 }
enum class  Slic3r::FaceOrientation : char { Slic3r::Up , Slic3r::Down , Slic3r::Vertical , Slic3r::Degenerate }

Functions

bool Slic3r::is_equal (float lh, float rh)
bool Slic3r::is_equal_for_sort (float lh, float rh)
bool Slic3r::is_equal (const Vec3f &lh, const Vec3f &rh)
static CoplanarEdges Slic3r::coplanar_edges (const indexed_triangle_set &mesh, const std::vector< Vec3i32 > &face_edge_ids, const Transform3d &trafo)
static FacetSliceType Slic3r::slice_facet (float slice_z, const stl_vertex *vertices, const stl_triangle_vertex_indices &indices, const Vec3i32 &edge_ids, const int idx_vertex_lowest, const bool horizontal, IntersectionLine &line_out)
static FacetSliceType Slic3r::slice_facet_for_cut_mesh (float slice_z, const stl_vertex *vertices, const stl_triangle_vertex_indices &indices, const Vec3i32 &edge_ids, const int idx_vertex_lowest, const bool horizontal, IntersectionLine &line_out)
template<typename TransformVertex>
void Slic3r::slice_facet_at_zs (const std::vector< Vec3f > &mesh_vertices, const TransformVertex &transform_vertex_fn, const stl_triangle_vertex_indices &indices, const Vec3i32 &edge_ids, const std::vector< float > &zs, std::vector< IntersectionLines > &lines, std::array< std::mutex, 64 > &lines_mutex)
template<typename TransformVertex, typename ThrowOnCancel>
static std::vector< IntersectionLines > Slic3r::slice_make_lines (const std::vector< stl_vertex > &vertices, const TransformVertex &transform_vertex_fn, const std::vector< stl_triangle_vertex_indices > &indices, const std::vector< Vec3i32 > &face_edge_ids, const std::vector< float > &zs, const ThrowOnCancel throw_on_cancel_fn)
template<typename TransformVertex, typename FaceFilter>
static IntersectionLines Slic3r::slice_make_lines (const std::vector< stl_vertex > &mesh_vertices, const TransformVertex &transform_vertex_fn, const std::vector< stl_triangle_vertex_indices > &mesh_faces, const std::vector< Vec3i32 > &face_edge_ids, const float plane_z, FaceFilter face_filter)
template<bool ProjectionFromTop>
void Slic3r::slice_facet_with_slabs (const std::vector< Vec3f > &mesh_vertices, const std::vector< stl_triangle_vertex_indices > &mesh_triangles, const size_t facet_idx, const Vec3i32 &facet_neighbors, const Vec3i32 &facet_edge_ids, const int num_edges, const std::vector< float > &zs, SlabLines &lines, std::array< std::mutex, 64 > &lines_mutex)
template<typename ThrowOnCancel>
std::pair< SlabLines, SlabLines > Slic3r::slice_slabs_make_lines (const std::vector< stl_vertex > &vertices, const std::vector< stl_triangle_vertex_indices > &indices, const std::vector< Vec3i32 > &face_neighbors, const std::vector< Vec3i32 > &face_edge_ids, const int num_edges, const std::vector< FaceOrientation > &face_orientation, const std::vector< float > &zs, bool top, bool bottom, const ThrowOnCancel throw_on_cancel_fn)
static void Slic3r::chain_lines_by_triangle_connectivity (IntersectionLines &lines, const CoplanarEdges &coplanar_edges, Polygons &loops, std::vector< OpenPolyline > &open_polylines)
std::vector< OpenPolyline * > Slic3r::open_polylines_sorted (std::vector< OpenPolyline > &open_polylines, bool update_lengths)
static void Slic3r::chain_open_polylines_exact (std::vector< OpenPolyline > &open_polylines, Polygons &loops, bool try_connect_reversed)
static void Slic3r::chain_open_polylines_close_gaps (std::vector< OpenPolyline > &open_polylines, Polygons &loops, double max_gap, bool try_connect_reversed)
static Polygons Slic3r::make_loops (IntersectionLines &lines, const CoplanarEdges &coplanar_edges)
template<typename ThrowOnCancel>
static std::vector< Polygons > Slic3r::make_loops (std::vector< IntersectionLines > &lines, const CoplanarEdges &coplanar_edges, const MeshSlicingParams &params, ThrowOnCancel throw_on_cancel)
template<bool ProjectionFromTop, typename ThrowOnCancel>
static std::vector< Polygons > Slic3r::make_slab_loops (SlabLines &lines, int num_edges, ThrowOnCancel throw_on_cancel)
static ExPolygons Slic3r::make_expolygons_simple (std::vector< IntersectionLine > &lines)
static void Slic3r::make_expolygons (const Polygons &loops, const float closing_radius, const float extra_offset, PolyFillType fill_type, ExPolygons *slices)
static Transform3f Slic3r::make_trafo_for_slicing (const Transform3d &trafo)
static bool Slic3r::is_identity (const Transform3d &trafo)
static std::vector< stl_vertex > Slic3r::transform_mesh_vertices_for_slicing (const indexed_triangle_set &mesh, const Transform3d &trafo)
std::vector< Polygons > Slic3r::slice_mesh (const indexed_triangle_set &mesh, const std::vector< float > &zs, const MeshSlicingParams &params, std::function< void()> throw_on_cancel)
Polygons Slic3r::slice_mesh (const indexed_triangle_set &mesh, const float plane_z, const MeshSlicingParams &params)
std::vector< ExPolygons > Slic3r::slice_mesh_ex (const indexed_triangle_set &mesh, const std::vector< float > &zs, const MeshSlicingParamsEx &params, std::function< void()> throw_on_cancel)
void Slic3r::slice_mesh_slabs (const indexed_triangle_set &mesh, const std::vector< float > &zs, const Transform3d &trafo, std::vector< Polygons > *out_top, std::vector< Polygons > *out_bottom, std::vector< std::pair< Vec3f, Vec3f > > *vertical_points, std::function< void()> throw_on_cancel)
static void Slic3r::triangulate_slice (indexed_triangle_set &its, IntersectionLines &lines, std::vector< int > &slice_vertices, int num_original_vertices, float z, bool triangulate, bool normals_down, const std::map< int, Vec3f > &section_vertices_map)
void Slic3r::project_mesh (const indexed_triangle_set &mesh, const Transform3d &trafo, Polygons *out_top, Polygons *out_bottom, std::function< void()> throw_on_cancel)
Polygons Slic3r::project_mesh (const indexed_triangle_set &mesh, const Transform3d &trafo, std::function< void()> throw_on_cancel)
void Slic3r::cut_mesh (const indexed_triangle_set &mesh, float z, indexed_triangle_set *upper, indexed_triangle_set *lower, bool triangulate_caps)

Variables

const float Slic3r::epson = 1e-3

Class Documentation

◆ Slic3r::SlabLines

struct Slic3r::SlabLines
Collaboration diagram for Slic3r::SlabLines:
Class Members
vector< IntersectionLines > at_slice
vector< IntersectionLines > between_slices