Commit Graph

18760 Commits

Author SHA1 Message Date
PavelMikus
e377e58cd2 Updated weights for curve fitting, ensured snapping to sharp corners
Fixed debug exports after refactorings.
2022-04-25 12:42:51 +02:00
Godrak
43d9166382 nomralize weights of points before curve fitting and fitted value interpolation 2022-04-25 12:42:51 +02:00
PavelMikus
68cf4db58e interpolate fitted and original position during b spline alignment -
push points with large weight more towards their original position
2022-04-25 12:42:51 +02:00
PavelMikus
137fa35238 Postpone seam picking for spNearest configuration to the place_seam method. 2022-04-25 12:42:51 +02:00
PavelMikus
83f3ca27dc reworked and improved the find_next_seam_in_layer method:
Now uses find nearby_points with radius to save some computations
if all points are far.
From the nearby points, it finds the nearest and best point, and tries
to use them in this order (preivously only nearest was considered).
This helps to snap the alignment to nearby sharp corners if present.
2022-04-25 12:42:51 +02:00
PavelMikus
04d4a0d4f7 when searching for central enforcer (for alignment purposes), find properly the first
enforced segment. Fixed issue where if the enforced segment was painted over the start/end of the
perimeter, part of the enforced points was not considered.
2022-04-25 12:42:51 +02:00
Vojtech Bubnik
2dfabb7e69 Fixing missing include. 2022-04-25 12:42:51 +02:00
Vojtech Bubnik
399b7f79e8 Little more refactoring of SeamPlacer. 2022-04-25 12:42:51 +02:00
Vojtech Bubnik
8c2e6aba79 On MSVC, std::deque degenerates to a list of pointers, which defeats
its purpose of reducing allocator load and memory fragmentation.
https://github.com/microsoft/STL/issues/147#issuecomment-1090148740
Slic3r::deque<> compiles to boost::container::deque<> on Windows,
to std::deque<> on other systems.
SeamPlacer newly uses Slic3r::deque<>.
2022-04-25 12:42:51 +02:00
Vojtech Bubnik
adb467286f Documented the seam placement corner penalty with an image. 2022-04-25 12:42:51 +02:00
Vojtech Bubnik
853b8adf80 Little refactoring of SeamPlacer.
Moved color mapping functions to Color.hpp
Removed the "extern" keyword from Color.hpp
2022-04-25 12:42:51 +02:00
Vojtech Bubnik
f5709345ad GCode export: Replaced std::strings in G-code comments with string_views.
Seam placer: Detecting perimeter by the pointer and size of the
comment_perimeter string_view, only placing seams for perimeters.
2022-04-25 12:42:51 +02:00
PavelMikus
fb2621c03c Negative volumes raycasting fix - normal was flipped between iterations, incorrect algorithm for hit detection
Debug files export fix after refactoring
2022-04-25 12:42:51 +02:00
Vojtech Bubnik
8ce36e9137 Refactoring of SeamPlacer:
Replaced shared_ptr<> with deque.
Merged multiple vectors into one.
Refactoring using common helper functions (prev/next_idx_modulo(),
angle(), ...)
AABBTreeIndirect::intersect_ray_all_hits(): Reuse memory of the hits cache.
2022-04-25 12:42:51 +02:00
PavelMikus
3b8cfc62da fixed drawing seams on multipart objects
removed oversampling for blockers
improved drawing seams over sharp features
2022-04-25 12:42:51 +02:00
PavelMikus
47fc39a4ba fixed misleanding or wrong comments of the fitting function 2022-04-25 12:42:51 +02:00
PavelMikus
ae89d65e3e added description for the parameter count increase 2022-04-25 12:42:51 +02:00
PavelMikus
396d3215bd Refactoring of curve fitting algorithm:
removal of artificial extension at the ends of the curve
removal of observation points normalization
added clamping of parameter index which compensates for under-represented spline segments
added parameter for level of freedom at the ends of the curve
2022-04-25 12:42:51 +02:00
Vojtech Bubnik
c19770189f Follow-up to 1c9ba291fe32bc4a4c78cabbab0639b0c164f23f
Refactoring of Curves.hpp for better memory management and vectorization
2022-04-25 12:42:51 +02:00
Vojtech Bubnik
42e802c1b8 Refactoring of Curves.hpp for better memory management and vectorization
(replaced vector of vectors with Eigen 2D matrices).
2022-04-25 12:42:51 +02:00
Vojtech Bubnik
bd8ce6fabd Follow-up to 9cb51caead9dee5c4d12a4ef5f925b5efeb00b75
Fixing compilation on GCC
2022-04-25 12:42:51 +02:00
Vojtech Bubnik
e95d19b560 WIP, FIXME: Worked around a Perl integration test failure
in t/perimeters.t, see the comment
FIXME skip the 1st layer in the test 'loops start on concave point if any'

The failure is due to the seam smoothing, which brings the seam too far
away from the external perimeter at the 1st layer, which uses significantly
wider extrusion rate than the other layers. Moving the seam point from
the external perimeter causes an error when projecting the seam point
back to the external perimeter, where the projection lands not exactly
at a corner point, creating a short segment at the end of a polygon loop.
2022-04-25 12:42:51 +02:00
Vojtech Bubnik
7d02647ebf Removed various Point::ccw() and Point::ccw_angle() methods, they were
provided for Perl bindings and their semantic was confusing.
Implemented free function angle() to measure angle between two vectors.
Reworked Polygon::convex/concave_points(), changed the meaning of their
angle threshold parameter.
Removed some unused methods from Perl bindings and tests.
Reworked the "wipe inside at the external perimeter" function
after Point::ccw_angle() was removed.
2022-04-25 12:42:51 +02:00
PavelMikus
156a60017d fixed ExPolygons dealocation while using EdgeGrid
fixed warnings in Bicubic.h file
2022-04-25 12:42:51 +02:00
PavelMikus
965803822e remove invalid comment 2022-04-25 12:42:51 +02:00
PavelMikus
1164449d4e compute overhang distance using SDF
detect embedded (inner) perimeter points and prefer them for seam placement
2022-04-25 12:42:51 +02:00
PavelMikus
191e788aa0 make Random seams disaligned 2022-04-25 12:42:51 +02:00
PavelMikus
15135ef2ed fixes, central enforced point preference 2022-04-25 12:42:51 +02:00
PavelMikus
5c23d471de BSplines, Polynomial fitting 2022-04-25 12:42:51 +02:00
PavelMikus
bbcd6be250 Implemented piecewise data (curve) fitting with variable kernels 2022-04-25 12:42:51 +02:00
PavelMikus
bb89b630d9 implemented occlusion estimation for objects with negative volumes 2022-04-25 12:42:51 +02:00
PavelMikus
ca259caf33 fix ccw angle computation in Point.cpp 2022-04-25 12:42:51 +02:00
PavelMikus
177a1fd54a finalize integration into GCode.cpp export functions, remove unused
edge grids
2022-04-25 12:42:51 +02:00
PavelMikus
6dbc7149be parameter fixes, alignemnt for enforcers simplified 2022-04-25 12:42:51 +02:00
PavelMikus
c640fb854f bug fix: using trafo() instead of trafo_centred() caused
misalignment between occlusion mesh and seam candidates
2022-04-25 12:42:51 +02:00
PavelMikus
2274965079 alignment from best candidate 2022-04-25 12:42:51 +02:00
PavelMikus
eccf1c1553 refactored raycasting - inverted direction of raycasting - now each face is tested
fixed bug with custom seam drawings - square distance parameter named incorrectly
2022-04-25 12:42:51 +02:00
PavelMikus
a9f5330ad2 using gauss function to smoothen criteria skips 2022-04-25 12:42:51 +02:00
Godrak
ab3c8d0fe8 implemented smooth angle penalty function 2022-04-25 12:42:51 +02:00
PavelMikus
a92d5038bd debug export svg info,
fixing problem with weird seam placement caused by disconnected scoring function
2022-04-25 12:42:51 +02:00
PavelMikus
962282c9ef split occlusion and enforcers/blockers into separate functions
added weights to polynomial fitting
2022-04-25 12:42:51 +02:00
PavelMikus
f837759928 fixed problem with multipart objects
fixed bug : model volume trafo was not considered
2022-04-25 12:42:51 +02:00
PavelMikus
a775bf2978 improved enforcers blockers oversampling, renamed parameter 2022-04-25 12:42:51 +02:00
PavelMikus
8f7b86915a oversample polygons where necessary, due to seam enforcers & blockers 2022-04-25 12:42:51 +02:00
PavelMikus
87c276b7a4 comments and bugfix 2022-04-25 12:42:51 +02:00
PavelMikus
ad819850f9 tweaked parameters,
fixed minor bugs
2022-04-25 12:42:51 +02:00
PavelMikus
c72687c96c computing smooth score instead of binary decision when picking seams
some basic documentation
2022-04-25 12:42:51 +02:00
PavelMikus
105b67c9a7 presorting seams before alignemnt
mesh decimation for speed up
2022-04-25 12:42:51 +02:00
PavelMikus
f018160e72 implemented polynomial alignment,
however, initital seam placement is not ideal
- hard to balance visual cues and angle information
2022-04-25 12:42:51 +02:00
PavelMikus
ffc7452d9e improved visibility calculation - it now considers normals and
accordingly counts only hits which have similar normal
2022-04-25 12:42:51 +02:00