mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-20 17:32:26 +00:00
* Clipper: Verify range of int32 coordinates on input. Cherry-picked from prusa3d/PrusaSlicer@fa7debf49d Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com> * ClipperLib: Optimized PointInPolygon() to calculate cross products with int64s instead of doubles. Cherry-picked from prusa3d/PrusaSlicer@9dca8403fe Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com> * Reworked the ClipperLib / Polygon types to use the tbb::scallable_allocator to better scale on multiple threads. Cherry-picked from prusa3d/PrusaSlicer@9cde96993e Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com> * use tbb::scallable_allocator for Polygons and ExPolygon::holes to better scale on multiple threads Cherry-picked from prusa3d/PrusaSlicer@b67ad6434d Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com> * Fixed compilation on GCC and CLang Cherry-picked from prusa3d/PrusaSlicer@b3b44681a9 Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com> * Remove clipper2 which is not used * Removed shiny profiler from clipperlib Cherry-picked from prusa3d/PrusaSlicer@7e77048593 Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com> * ClipperLib: Further optimization of memory allocation using scalable_allocator. ClipperLib: SimplifyPolygon() - changed default winding number to positive, added strictly_simple parameter. ClipperUtlis simplify_polygons() - removed "remove_collinear" parameter Cherry-picked from prusa3d/PrusaSlicer@a7e17df25f Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com> * ClipperLib: emplace_back() instead of push_back(). Cherry-picked from prusa3d/PrusaSlicer@2e150795b1 Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com> * Fixed issue in a 32bit clipper, where IntersectPoint() checked for the Y coordinate of the calculated intersection point for validity, but the Y coordinate was already rounded to 32bits, thus an overflow may have in rare cases masked invalidity of the result. Cherry-picked from prusa3d/PrusaSlicer@b39c33414f Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com> * Fixed Vojtech's out of boundary assert in Clipper library. Cherry-picked from prusa3d/PrusaSlicer@0a202dcff3 Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com> * Update clipper to 6.4.2. Cherry-picked from prusa3d/PrusaSlicer@b8b3cccb40 Co-authored-by: Lukáš Hejl <hejl.lukas@gmail.com> * Try fix cmake opencv --------- Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com> Co-authored-by: Lukáš Hejl <hejl.lukas@gmail.com>
98 lines
2.7 KiB
C++
98 lines
2.7 KiB
C++
#ifndef SLA_PAD_HPP
|
|
#define SLA_PAD_HPP
|
|
|
|
#include <vector>
|
|
#include <functional>
|
|
#include <cmath>
|
|
#include <string>
|
|
|
|
#include <libslic3r/Point.hpp>
|
|
|
|
struct indexed_triangle_set;
|
|
|
|
namespace Slic3r {
|
|
|
|
class ExPolygon;
|
|
class Polygon;
|
|
using ExPolygons = std::vector<ExPolygon>;
|
|
using Polygons = std::vector<Polygon, PointsAllocator<Polygon>>;
|
|
|
|
namespace sla {
|
|
|
|
using ThrowOnCancel = std::function<void(void)>;
|
|
|
|
/// Calculate the polygon representing the silhouette.
|
|
void pad_blueprint(
|
|
const indexed_triangle_set &mesh, // input mesh
|
|
ExPolygons & output, // Output will be merged with
|
|
const std::vector<float> &, // Exact Z levels to sample
|
|
ThrowOnCancel thrfn = [] {}); // Function that throws if cancel was requested
|
|
|
|
void pad_blueprint(
|
|
const indexed_triangle_set &mesh,
|
|
ExPolygons & output,
|
|
float samplingheight = 0.1f, // The height range to sample
|
|
float layerheight = 0.05f, // The sampling height
|
|
ThrowOnCancel thrfn = [] {});
|
|
|
|
struct PadConfig {
|
|
double wall_thickness_mm = 1.;
|
|
double wall_height_mm = 1.;
|
|
double max_merge_dist_mm = 50;
|
|
double wall_slope = std::atan(1.0); // Universal constant for Pi/4
|
|
double brim_size_mm = 1.6;
|
|
|
|
struct EmbedObject {
|
|
double object_gap_mm = 1.;
|
|
double stick_stride_mm = 10.;
|
|
double stick_width_mm = 0.5;
|
|
double stick_penetration_mm = 0.1;
|
|
bool enabled = false;
|
|
bool everywhere = false;
|
|
operator bool() const { return enabled; }
|
|
} embed_object;
|
|
|
|
inline PadConfig() = default;
|
|
inline PadConfig(double thickness,
|
|
double height,
|
|
double mergedist,
|
|
double slope)
|
|
: wall_thickness_mm(thickness)
|
|
, wall_height_mm(height)
|
|
, max_merge_dist_mm(mergedist)
|
|
, wall_slope(slope)
|
|
{}
|
|
|
|
inline double bottom_offset() const
|
|
{
|
|
return (wall_thickness_mm + wall_height_mm) / std::tan(wall_slope);
|
|
}
|
|
|
|
inline double wing_distance() const
|
|
{
|
|
return wall_height_mm / std::tan(wall_slope);
|
|
}
|
|
|
|
inline double full_height() const
|
|
{
|
|
return wall_height_mm + wall_thickness_mm;
|
|
}
|
|
|
|
/// Returns the elevation needed for compensating the pad.
|
|
inline double required_elevation() const { return wall_thickness_mm; }
|
|
|
|
std::string validate() const;
|
|
};
|
|
|
|
void create_pad(
|
|
const ExPolygons & support_contours,
|
|
const ExPolygons & model_contours,
|
|
indexed_triangle_set &output_mesh,
|
|
const PadConfig & = PadConfig(),
|
|
ThrowOnCancel throw_on_cancel = [] {});
|
|
|
|
} // namespace sla
|
|
} // namespace Slic3r
|
|
|
|
#endif // SLABASEPOOL_HPP
|