mirror of https://github.com/CGAL/cgal
Fixed face filtering in case one of the summands does not have an outer boundary
This commit is contained in:
parent
b02d174ef2
commit
dbc45fac53
|
|
@ -83,19 +83,31 @@ public:
|
||||||
|
|
||||||
// If t_q is inside of P, or t_p is inside of Q, one polygon is completely
|
// If t_q is inside of P, or t_p is inside of Q, one polygon is completely
|
||||||
// inside of the other.
|
// inside of the other.
|
||||||
Point_2 t_q = *m_q.outer_boundary().vertices_begin() - Vector_2(ORIGIN, t);
|
|
||||||
Point_2 t_p = *m_p.outer_boundary().vertices_begin() + Vector_2(ORIGIN, t);
|
// Obtain a point on the boundary of m_q:
|
||||||
|
Point_2 t_q = (! m_q.outer_boundary().is_empty()) ?
|
||||||
|
*m_q.outer_boundary().vertices_begin() - Vector_2(ORIGIN, t) :
|
||||||
|
*m_q.holes_begin()->vertices_begin() - Vector_2(ORIGIN, t);
|
||||||
|
|
||||||
|
// Obtain a point on the boundary of m_p:
|
||||||
|
Point_2 t_p = (! m_p.outer_boundary().is_empty()) ?
|
||||||
|
*m_p.outer_boundary().vertices_begin() + Vector_2(ORIGIN, t) :
|
||||||
|
*m_p.holes_begin()->vertices_begin() + Vector_2(ORIGIN, t);
|
||||||
|
|
||||||
// Use bounded_side_2() instead of on_bounded_side() because the latter
|
// Use bounded_side_2() instead of on_bounded_side() because the latter
|
||||||
// checks vor simplicity every time.
|
// checks vor simplicity every time.
|
||||||
bool in_mp =
|
bool in_mp(true);
|
||||||
|
if (! m_p.outer_boundary().is_empty())
|
||||||
|
in_mp =
|
||||||
bounded_side_2(m_p.outer_boundary().vertices_begin(),
|
bounded_side_2(m_p.outer_boundary().vertices_begin(),
|
||||||
m_p.outer_boundary().vertices_end(), t_q,
|
m_p.outer_boundary().vertices_end(), t_q,
|
||||||
m_p.outer_boundary().traits_member()) == ON_BOUNDED_SIDE;
|
m_p.outer_boundary().traits_member()) == ON_BOUNDED_SIDE;
|
||||||
if (m_p.number_of_holes() == 0) {
|
if (m_p.number_of_holes() == 0) {
|
||||||
if (in_mp) return true;
|
if (in_mp) return true;
|
||||||
}
|
}
|
||||||
bool in_mq =
|
bool in_mq(true);
|
||||||
|
if (! m_q.outer_boundary().is_empty())
|
||||||
|
in_mq =
|
||||||
bounded_side_2(m_q.outer_boundary().vertices_begin(),
|
bounded_side_2(m_q.outer_boundary().vertices_begin(),
|
||||||
m_q.outer_boundary().vertices_end(), t_p,
|
m_q.outer_boundary().vertices_end(), t_p,
|
||||||
m_q.outer_boundary().traits_member()) == ON_BOUNDED_SIDE;
|
m_q.outer_boundary().traits_member()) == ON_BOUNDED_SIDE;
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,9 @@ private:
|
||||||
for (Face_iterator fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) {
|
for (Face_iterator fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) {
|
||||||
// Check whether the face is on the M-sum's border.
|
// Check whether the face is on the M-sum's border.
|
||||||
|
|
||||||
|
// The unbounded face cannot contribute to the Minkowski sum
|
||||||
|
if (fit->is_unbounded()) continue;
|
||||||
|
|
||||||
// If the face contains holes, it can't be on the Minkowski sum's border
|
// If the face contains holes, it can't be on the Minkowski sum's border
|
||||||
if (0 < fit->number_of_holes()) continue;
|
if (0 < fit->number_of_holes()) continue;
|
||||||
|
|
||||||
|
|
@ -177,10 +180,8 @@ private:
|
||||||
|
|
||||||
// When the reversed polygon 1, translated by a point inside of this face,
|
// When the reversed polygon 1, translated by a point inside of this face,
|
||||||
// collides with polygon 2, this cannot be a hole
|
// collides with polygon 2, this cannot be a hole
|
||||||
if (! is_outer_boundary_empty) {
|
|
||||||
Point_2 inner_point = get_point_in_face(fit);
|
Point_2 inner_point = get_point_in_face(fit);
|
||||||
if (collision_detector.check_collision(inner_point)) continue;
|
if (collision_detector.check_collision(inner_point)) continue;
|
||||||
}
|
|
||||||
|
|
||||||
add_face(fit, holes);
|
add_face(fit, holes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
8
|
||||||
|
0 0 40 0 40 30 30 30 30 60 10 60 10 30 0 30
|
||||||
|
0
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
0
|
||||||
|
1
|
||||||
|
4 0 40 50 40 50 0 0 0
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
8
|
||||||
|
0 0
|
||||||
|
40 0
|
||||||
|
40 30
|
||||||
|
30 30
|
||||||
|
30 40
|
||||||
|
10 40
|
||||||
|
10 30
|
||||||
|
0 30
|
||||||
|
0
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
0
|
||||||
|
1
|
||||||
|
4 0 40 50 60 50 0 0 0
|
||||||
|
|
@ -14,3 +14,9 @@ data/pwh7.dat data/pwh6.dat
|
||||||
data/pwh2.dat data/pwh8.dat
|
data/pwh2.dat data/pwh8.dat
|
||||||
data/pwh8.dat data/pwh2.dat
|
data/pwh8.dat data/pwh2.dat
|
||||||
data/pwh8.dat data/pwh8.dat
|
data/pwh8.dat data/pwh8.dat
|
||||||
|
data/pwh9.dat data/pwh10.dat
|
||||||
|
data/pwh10.dat data/pwh9.dat
|
||||||
|
data/pwh11.dat data/pwh10.dat
|
||||||
|
data/pwh10.dat data/pwh11.dat
|
||||||
|
data/pwh9.dat data/pwh12.dat
|
||||||
|
data/pwh12.dat data/pwh9.dat
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue