Switch orientation of passed into Voronoi generator, because previously were opposite.

So previously, SOURCE_CATEGORY_SEGMENT_START_POINT and SOURCE_CATEGORY_SEGMENT_END_POINT were swapped.
This commit is contained in:
Lukáš Hejl 2024-01-31 17:40:09 +01:00
parent 530f3b93d2
commit 5f37d422f0
3 changed files with 23 additions and 25 deletions

View File

@ -21,25 +21,6 @@
#define SKELETAL_TRAPEZOIDATION_BEAD_SEARCH_MAX 1000 //A limit to how long it'll keep searching for adjacent beads. Increasing will re-use beadings more often (saving performance), but search longer for beading (costing performance). #define SKELETAL_TRAPEZOIDATION_BEAD_SEARCH_MAX 1000 //A limit to how long it'll keep searching for adjacent beads. Increasing will re-use beadings more often (saving performance), but search longer for beading (costing performance).
namespace boost::polygon {
template<> struct geometry_concept<Slic3r::Arachne::PolygonsSegmentIndex>
{
typedef segment_concept type;
};
template<> struct segment_traits<Slic3r::Arachne::PolygonsSegmentIndex>
{
typedef coord_t coordinate_type;
typedef Slic3r::Point point_type;
static inline point_type get(const Slic3r::Arachne::PolygonsSegmentIndex &CSegment, direction_1d dir)
{
return dir.to_int() ? CSegment.p() : CSegment.next().p();
}
};
} // namespace boost::polygon
namespace Slic3r::Arachne namespace Slic3r::Arachne
{ {

View File

@ -27,5 +27,24 @@ public:
} // namespace Slic3r::Arachne } // namespace Slic3r::Arachne
namespace boost::polygon {
template<> struct geometry_concept<Slic3r::Arachne::PolygonsSegmentIndex>
{
typedef segment_concept type;
};
template<> struct segment_traits<Slic3r::Arachne::PolygonsSegmentIndex>
{
typedef coord_t coordinate_type;
typedef Slic3r::Point point_type;
static inline point_type get(const Slic3r::Arachne::PolygonsSegmentIndex &CSegment, direction_1d dir)
{
return dir.to_int() ? CSegment.to() : CSegment.from();
}
};
} // namespace boost::polygon
#endif//UTILS_POLYGONS_SEGMENT_INDEX_H #endif//UTILS_POLYGONS_SEGMENT_INDEX_H

View File

@ -34,11 +34,11 @@ Point VoronoiUtils::getSourcePoint(const vd_t::cell_type& cell, const std::vecto
break; break;
case boost::polygon::SOURCE_CATEGORY_SEGMENT_START_POINT: case boost::polygon::SOURCE_CATEGORY_SEGMENT_START_POINT:
assert(cell.source_index() < segments.size()); assert(cell.source_index() < segments.size());
return segments[cell.source_index()].to(); return boost::polygon::segment_traits<Segment>::get(segments[cell.source_index()], boost::polygon::LOW);
break; break;
case boost::polygon::SOURCE_CATEGORY_SEGMENT_END_POINT: case boost::polygon::SOURCE_CATEGORY_SEGMENT_END_POINT:
assert(cell.source_index() < segments.size()); assert(cell.source_index() < segments.size());
return segments[cell.source_index()].from(); return boost::polygon::segment_traits<Segment>::get(segments[cell.source_index()], boost::polygon::HIGH);
break; break;
default: default:
assert(false && "getSourcePoint should only be called on point cells!\n"); assert(false && "getSourcePoint should only be called on point cells!\n");
@ -60,14 +60,12 @@ PolygonsPointIndex VoronoiUtils::getSourcePointIndex(const vd_t::cell_type& cell
switch (cell.source_category()) { switch (cell.source_category()) {
case boost::polygon::SOURCE_CATEGORY_SEGMENT_START_POINT: { case boost::polygon::SOURCE_CATEGORY_SEGMENT_START_POINT: {
assert(cell.source_index() < segments.size()); assert(cell.source_index() < segments.size());
PolygonsPointIndex ret = segments[cell.source_index()]; return segments[cell.source_index()];
++ret;
return ret;
break; break;
} }
case boost::polygon::SOURCE_CATEGORY_SEGMENT_END_POINT: { case boost::polygon::SOURCE_CATEGORY_SEGMENT_END_POINT: {
assert(cell.source_index() < segments.size()); assert(cell.source_index() < segments.size());
return segments[cell.source_index()]; return segments[cell.source_index()].next();
break; break;
} }
default: default: