mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 00:31:11 -06:00
Vojtech likes to use Sublime on Windows to get the wheels rolling.
This commit is contained in:
parent
d392858ee3
commit
7da68c91a5
26 changed files with 408 additions and 864 deletions
|
@ -594,6 +594,10 @@ void union_pt_chained(const Slic3r::Polygons &subject, Slic3r::Polygons* retval,
|
|||
{
|
||||
ClipperLib::PolyTree pt;
|
||||
union_pt(subject, &pt, safety_offset_);
|
||||
if (&subject == retval)
|
||||
// It is safe to use the same variable for input and output, because this function makes
|
||||
// a temporary copy of the results.
|
||||
retval->clear();
|
||||
traverse_pt(pt.Childs, retval);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ MultiPoint::rotate(double angle)
|
|||
double s = sin(angle);
|
||||
double c = cos(angle);
|
||||
for (Points::iterator it = points.begin(); it != points.end(); ++it) {
|
||||
(*it).rotate(angle);
|
||||
double cur_x = (double)it->x;
|
||||
double cur_y = (double)it->y;
|
||||
it->x = (coord_t)round(c * cur_x - s * cur_y);
|
||||
|
|
|
@ -11,7 +11,7 @@ struct Chaining
|
|||
|
||||
#ifndef sqr
|
||||
template<typename T>
|
||||
inline sqr(T x) { return x * x; }
|
||||
inline T sqr(T x) { return x * x; }
|
||||
#endif /* sqr */
|
||||
|
||||
template<typename T>
|
||||
|
@ -43,7 +43,6 @@ inline int nearest_point_index(const std::vector<Chaining> &pairs, const Point &
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
@ -64,12 +63,13 @@ Polylines PolylineCollection::chained_path_from(
|
|||
if (! no_reverse)
|
||||
c.last = src[i].last_point();
|
||||
c.idx = i;
|
||||
endpoints.push_back(c);
|
||||
}
|
||||
|
||||
Polylines retval;
|
||||
while (! endpoints.empty()) {
|
||||
// find nearest point
|
||||
int endpoint_index = nearest_point_index<double>(endpoints, start_near, no_reverse);
|
||||
assert(endpoint_index >= 0 && endpoint_index < endpoints.size() * 2);
|
||||
#if SLIC3R_CPPVER > 11
|
||||
retval.push_back(std::move(src[endpoints[endpoint_index/2].idx]));
|
||||
#else
|
||||
|
@ -80,6 +80,7 @@ Polylines PolylineCollection::chained_path_from(
|
|||
endpoints.erase(endpoints.begin() + endpoint_index/2);
|
||||
start_near = retval.back().last_point();
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
#if SLIC3R_CPPVER > 11
|
||||
|
|
|
@ -445,7 +445,8 @@ TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<Polygons>* la
|
|||
float min_z = fminf(facet->vertex[0].z, fminf(facet->vertex[1].z, facet->vertex[2].z));
|
||||
float max_z = fmaxf(facet->vertex[0].z, fmaxf(facet->vertex[1].z, facet->vertex[2].z));
|
||||
|
||||
#ifdef SLIC3R_DEBUG
|
||||
#if 0
|
||||
// #ifdef SLIC3R_DEBUG
|
||||
printf("\n==> FACET %d (%f,%f,%f - %f,%f,%f - %f,%f,%f):\n", facet_idx,
|
||||
facet->vertex[0].x, facet->vertex[0].y, facet->vertex[0].z,
|
||||
facet->vertex[1].x, facet->vertex[1].y, facet->vertex[1].z,
|
||||
|
@ -457,7 +458,8 @@ TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<Polygons>* la
|
|||
std::vector<float>::const_iterator min_layer, max_layer;
|
||||
min_layer = std::lower_bound(z.begin(), z.end(), min_z); // first layer whose slice_z is >= min_z
|
||||
max_layer = std::upper_bound(z.begin() + (min_layer - z.begin()), z.end(), max_z) - 1; // last layer whose slice_z is <= max_z
|
||||
#ifdef SLIC3R_DEBUG
|
||||
#if 0
|
||||
// #ifdef SLIC3R_DEBUG
|
||||
printf("layers: min = %d, max = %d\n", (int)(min_layer - z.begin()), (int)(max_layer - z.begin()));
|
||||
#endif
|
||||
|
||||
|
@ -473,7 +475,8 @@ TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<Polygons>* la
|
|||
layers->resize(z.size());
|
||||
for (std::vector<IntersectionLines>::iterator it = lines.begin(); it != lines.end(); ++it) {
|
||||
size_t layer_idx = it - lines.begin();
|
||||
#ifdef SLIC3R_DEBUG
|
||||
#if 0
|
||||
// #ifdef SLIC3R_DEBUG
|
||||
printf("Layer %zu:\n", layer_idx);
|
||||
#endif
|
||||
this->make_loops(*it, &(*layers)[layer_idx]);
|
||||
|
@ -488,7 +491,8 @@ TriangleMeshSlicer::slice(const std::vector<float> &z, std::vector<ExPolygons>*
|
|||
|
||||
layers->resize(z.size());
|
||||
for (std::vector<Polygons>::const_iterator loops = layers_p.begin(); loops != layers_p.end(); ++loops) {
|
||||
#ifdef SLIC3R_DEBUG
|
||||
#if 0
|
||||
// #ifdef SLIC3R_DEBUG
|
||||
size_t layer_id = loops - layers_p.begin();
|
||||
printf("Layer %zu (slice_z = %.2f):\n", layer_id, z[layer_id]);
|
||||
#endif
|
||||
|
@ -712,7 +716,8 @@ TriangleMeshSlicer::make_loops(std::vector<IntersectionLine> &lines, Polygons* l
|
|||
}
|
||||
loops->push_back(p);
|
||||
|
||||
#ifdef SLIC3R_DEBUG
|
||||
#if 0
|
||||
// #ifdef SLIC3R_DEBUG
|
||||
printf(" Discovered %s polygon of %d points\n", (p.is_counter_clockwise() ? "ccw" : "cw"), (int)p.points.size());
|
||||
#endif
|
||||
|
||||
|
@ -833,7 +838,8 @@ TriangleMeshSlicer::make_expolygons(const Polygons &loops, ExPolygons* slices)
|
|||
ExPolygons ex_slices;
|
||||
offset2(p_slices, &ex_slices, +safety_offset, -safety_offset);
|
||||
|
||||
#ifdef SLIC3R_DEBUG
|
||||
#if 0
|
||||
// #ifdef SLIC3R_DEBUG
|
||||
size_t holes_count = 0;
|
||||
for (ExPolygons::const_iterator e = ex_slices.begin(); e != ex_slices.end(); ++e) {
|
||||
holes_count += e->holes.size();
|
||||
|
@ -1052,7 +1058,8 @@ TriangleMeshSlicer::TriangleMeshSlicer(TriangleMesh* _mesh) : mesh(_mesh), v_sca
|
|||
}
|
||||
this->facets_edges[facet_idx][i] = edge_idx;
|
||||
|
||||
#ifdef SLIC3R_DEBUG
|
||||
#if 0
|
||||
// #ifdef SLIC3R_DEBUG
|
||||
printf(" [facet %d, edge %d] a_id = %d, b_id = %d --> edge %d\n", facet_idx, i, a_id, b_id, edge_idx);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue