mirror of https://github.com/CGAL/cgal
Merge pull request #3486 from efifogel/Ms_2-empty_ouetr_boundary-efif
Fixed face filtering in case one of the summands does not have an out…
This commit is contained in:
commit
cd75eac35a
|
|
@ -68,10 +68,17 @@ Release date: March 2019
|
|||
`Arr_polyline_traits_2`, `Arr_polycurve_traits_2`, and
|
||||
`Arr_polycurve_basic_traits_2`.
|
||||
|
||||
### 2D Minkowski Sums
|
||||
|
||||
- Fixed a bug in the function that computed the Minkowski sum using the
|
||||
reduced-convolution method. In particular, correctly handled the case where
|
||||
one of the summands does not have an outer boundaey.
|
||||
|
||||
### CGAL and the Boost Graph Library (BGL)
|
||||
|
||||
- Add function `write_wrl()` for writing into VRML 2.0 format.
|
||||
|
||||
|
||||
Release 4.13
|
||||
------------
|
||||
|
||||
|
|
|
|||
|
|
@ -83,22 +83,34 @@ public:
|
|||
|
||||
// If t_q is inside of P, or t_p is inside of Q, one polygon is completely
|
||||
// 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
|
||||
// checks vor simplicity every time.
|
||||
bool in_mp =
|
||||
bounded_side_2(m_p.outer_boundary().vertices_begin(),
|
||||
m_p.outer_boundary().vertices_end(), t_q,
|
||||
m_p.outer_boundary().traits_member()) == ON_BOUNDED_SIDE;
|
||||
bool in_mp(true);
|
||||
if (! m_p.outer_boundary().is_empty())
|
||||
in_mp =
|
||||
bounded_side_2(m_p.outer_boundary().vertices_begin(),
|
||||
m_p.outer_boundary().vertices_end(), t_q,
|
||||
m_p.outer_boundary().traits_member()) == ON_BOUNDED_SIDE;
|
||||
if (m_p.number_of_holes() == 0) {
|
||||
if (in_mp) return true;
|
||||
}
|
||||
bool in_mq =
|
||||
bounded_side_2(m_q.outer_boundary().vertices_begin(),
|
||||
m_q.outer_boundary().vertices_end(), t_p,
|
||||
m_q.outer_boundary().traits_member()) == ON_BOUNDED_SIDE;
|
||||
bool in_mq(true);
|
||||
if (! m_q.outer_boundary().is_empty())
|
||||
in_mq =
|
||||
bounded_side_2(m_q.outer_boundary().vertices_begin(),
|
||||
m_q.outer_boundary().vertices_end(), t_p,
|
||||
m_q.outer_boundary().traits_member()) == ON_BOUNDED_SIDE;
|
||||
if (m_q.number_of_holes() == 0) {
|
||||
if (in_mq) return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,6 +169,9 @@ private:
|
|||
for (Face_iterator fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) {
|
||||
// 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 (0 < fit->number_of_holes()) continue;
|
||||
|
||||
|
|
@ -177,10 +180,8 @@ private:
|
|||
|
||||
// When the reversed polygon 1, translated by a point inside of this face,
|
||||
// collides with polygon 2, this cannot be a hole
|
||||
if (! is_outer_boundary_empty) {
|
||||
Point_2 inner_point = get_point_in_face(fit);
|
||||
if (collision_detector.check_collision(inner_point)) continue;
|
||||
}
|
||||
Point_2 inner_point = get_point_in_face(fit);
|
||||
if (collision_detector.check_collision(inner_point)) continue;
|
||||
|
||||
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/pwh8.dat data/pwh2.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