mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 18:27:58 -06:00
Bugfix: medial axis missed some segments. #2144
This commit is contained in:
parent
e897fbbd51
commit
30fa055995
6 changed files with 48 additions and 8 deletions
|
@ -270,15 +270,14 @@ MedialAxis::is_valid_edge(const VD::edge_type& edge) const
|
|||
if (segment1.a == segment2.b || segment1.b == segment2.a) return false;
|
||||
|
||||
// calculate relative angle between the two boundary segments
|
||||
Vector vec1 = segment1.vector();
|
||||
Vector vec2 = segment2.vector();
|
||||
double angle = atan2(vec1.x*vec2.y - vec1.y*vec2.x, vec1.x*vec2.x + vec1.y*vec2.y);
|
||||
double angle = fabs(segment2.orientation() - segment1.orientation());
|
||||
|
||||
// fabs(angle) ranges from 0 (collinear, same direction) to PI (collinear, opposite direction)
|
||||
// we're interested only in segments close to the second case (facing segments)
|
||||
// so we allow some tolerance (say, 30°)
|
||||
if (fabs(angle) < PI - PI/3) return false;
|
||||
|
||||
if (angle < PI*2/3 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// each vertex is equidistant to both cell segments
|
||||
// but such distance might differ between the two vertices;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue