OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::PaintCLI::anonymous_namespace{PaintCLI.cpp} Namespace Reference

Typedefs

using json = nlohmann::json

Functions

double its_surface_area (const indexed_triangle_set &its)
BoundingBoxf3 its_referenced_bbox (const indexed_triangle_set &its)
json vec3_to_json (const Vec3d &v)
json bbox_to_json (const BoundingBoxf3 &bb)
json state_entry (const std::string &label, const indexed_triangle_set &its)
json inspect_layer (const ModelVolume &mv, const FacetsAnnotation &fa, const std::vector< std::pair< EnforcerBlockerType, std::string > > &states, size_t &n_facets_out)
const std::vector< std::pair< EnforcerBlockerType, std::string > > & supports_states ()
const std::vector< std::pair< EnforcerBlockerType, std::string > > & fuzzy_states ()
const std::vector< std::pair< EnforcerBlockerType, std::string > > & mmu_states ()

Typedef Documentation

◆ json

using Slic3r::PaintCLI::anonymous_namespace{PaintCLI.cpp}::json = nlohmann::json

Function Documentation

◆ bbox_to_json()

json Slic3r::PaintCLI::anonymous_namespace{PaintCLI.cpp}::bbox_to_json ( const BoundingBoxf3 & bb)
61{
62 return {
63 { "min", vec3_to_json(bb.min) },
64 { "max", vec3_to_json(bb.max) },
65 { "size", vec3_to_json(Vec3d(bb.max - bb.min)) },
66 };
67}
json vec3_to_json(const Vec3d &v)
Definition PaintCLI.cpp:55
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vec3d
Definition Point.hpp:68

References bbox_to_json(), Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::max, Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::min, and vec3_to_json().

Referenced by bbox_to_json(), and state_entry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fuzzy_states()

const std::vector< std::pair< EnforcerBlockerType, std::string > > & Slic3r::PaintCLI::anonymous_namespace{PaintCLI.cpp}::fuzzy_states ( )
116{
117 // FUZZY_SKIN is an enum alias for ENFORCER; the layer is single-state.
118 static const std::vector<std::pair<EnforcerBlockerType, std::string>> s = {
119 { EnforcerBlockerType::FUZZY_SKIN, "FUZZY_SKIN" },
120 };
121 return s;
122}
@ FUZZY_SKIN
Definition TriangleSelector.hpp:30

References Slic3r::FUZZY_SKIN, and fuzzy_states().

Referenced by fuzzy_states().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inspect_layer()

json Slic3r::PaintCLI::anonymous_namespace{PaintCLI.cpp}::inspect_layer ( const ModelVolume & mv,
const FacetsAnnotation & fa,
const std::vector< std::pair< EnforcerBlockerType, std::string > > & states,
size_t & n_facets_out )
86{
87 if (fa.empty())
88 return { { "empty", true } };
89
90 json entries = json::array();
91 for (const auto &st : states) {
92 if (!fa.has_facets(mv, st.first))
93 continue;
94 indexed_triangle_set its = fa.get_facets_strict(mv, st.first);
95 if (its.indices.empty())
96 continue;
97 n_facets_out += its.indices.size();
98 entries.push_back(state_entry(st.second, its));
99 }
100 return {
101 { "empty", entries.empty() },
102 { "states", std::move(entries) },
103 };
104}
bool empty() const
Definition Model.hpp:782
bool has_facets(const ModelVolume &mv, EnforcerBlockerType type) const
Definition Model.cpp:4086
indexed_triangle_set get_facets_strict(const ModelVolume &mv, EnforcerBlockerType type) const
Definition Model.cpp:4078
json state_entry(const std::string &label, const indexed_triangle_set &its)
Definition PaintCLI.cpp:70
nlohmann::json json
Definition AssembleList.cpp:42

References Slic3r::FacetsAnnotation::empty(), Slic3r::FacetsAnnotation::get_facets_strict(), Slic3r::FacetsAnnotation::has_facets(), inspect_layer(), and state_entry().

Referenced by inspect_layer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ its_referenced_bbox()

BoundingBoxf3 Slic3r::PaintCLI::anonymous_namespace{PaintCLI.cpp}::its_referenced_bbox ( const indexed_triangle_set & its)
42{
44 bool first = true;
45 for (const stl_triangle_vertex_indices &t : its.indices) {
46 for (int k = 0; k < 3; ++k) {
47 const Vec3d v = its.vertices[t(k)].cast<double>();
48 if (first) { bb.min = bb.max = v; first = false; }
49 else bb.merge(v);
50 }
51 }
52 return bb;
53}
void merge(const PointType &point)
Definition BoundingBox.cpp:139
Definition BoundingBox.hpp:265

References its_referenced_bbox(), Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::max, Slic3r::BoundingBox3Base< PointType >::merge(), and Slic3r::BoundingBoxBase< PointType, std::vector< PointType > >::min.

Referenced by its_referenced_bbox(), and state_entry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ its_surface_area()

double Slic3r::PaintCLI::anonymous_namespace{PaintCLI.cpp}::its_surface_area ( const indexed_triangle_set & its)
27{
28 double total = 0.0;
29 for (const stl_triangle_vertex_indices &t : its.indices) {
30 const Vec3f &a = its.vertices[t(0)];
31 const Vec3f &b = its.vertices[t(1)];
32 const Vec3f &c = its.vertices[t(2)];
33 total += 0.5 * (b - a).cross(c - a).norm();
34 }
35 return total;
36}
Eigen::Matrix< float, 3, 1, Eigen::DontAlign > Vec3f
Definition Point.hpp:65
T cross(const boost::geometry::model::d2::point_xy< T > &v1, const boost::geometry::model::d2::point_xy< T > &v2)
Definition ExtrusionSimulator.cpp:168

References Slic3r::cross(), and its_surface_area().

Referenced by its_surface_area(), and state_entry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mmu_states()

const std::vector< std::pair< EnforcerBlockerType, std::string > > & Slic3r::PaintCLI::anonymous_namespace{PaintCLI.cpp}::mmu_states ( )
125{
126 static std::vector<std::pair<EnforcerBlockerType, std::string>> s = []{
127 std::vector<std::pair<EnforcerBlockerType, std::string>> v;
128 for (int i = 1; i <= int(EnforcerBlockerType::ExtruderMax); ++i)
129 v.emplace_back(EnforcerBlockerType(i), "extruder_" + std::to_string(i));
130 return v;
131 }();
132 return s;
133}
EnforcerBlockerType
Definition TriangleSelector.hpp:24
@ ExtruderMax
Definition TriangleSelector.hpp:66

References Slic3r::ExtruderMax, and mmu_states().

Referenced by mmu_states().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ state_entry()

json Slic3r::PaintCLI::anonymous_namespace{PaintCLI.cpp}::state_entry ( const std::string & label,
const indexed_triangle_set & its )
71{
72 return {
73 { "state", label },
74 { "facets", its.indices.size() },
75 { "area_mm2", its_surface_area(its) },
76 { "bbox", bbox_to_json(its_referenced_bbox(its)) },
77 };
78}
BoundingBoxf3 its_referenced_bbox(const indexed_triangle_set &its)
Definition PaintCLI.cpp:41
json bbox_to_json(const BoundingBoxf3 &bb)
Definition PaintCLI.cpp:60
double its_surface_area(const indexed_triangle_set &its)
Definition PaintCLI.cpp:26

References bbox_to_json(), its_referenced_bbox(), its_surface_area(), and state_entry().

Referenced by inspect_layer(), and state_entry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ supports_states()

const std::vector< std::pair< EnforcerBlockerType, std::string > > & Slic3r::PaintCLI::anonymous_namespace{PaintCLI.cpp}::supports_states ( )
107{
108 static const std::vector<std::pair<EnforcerBlockerType, std::string>> s = {
109 { EnforcerBlockerType::ENFORCER, "ENFORCER" },
110 { EnforcerBlockerType::BLOCKER, "BLOCKER" },
111 };
112 return s;
113}
@ ENFORCER
Definition TriangleSelector.hpp:27
@ BLOCKER
Definition TriangleSelector.hpp:28

References Slic3r::BLOCKER, Slic3r::ENFORCER, and supports_states().

Referenced by supports_states().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vec3_to_json()

json Slic3r::PaintCLI::anonymous_namespace{PaintCLI.cpp}::vec3_to_json ( const Vec3d & v)
56{
57 return json::array({ v.x(), v.y(), v.z() });
58}

References vec3_to_json().

Referenced by bbox_to_json(), and vec3_to_json().

Here is the call graph for this function:
Here is the caller graph for this function: