Merge branch 'releases/CGAL-4.11-branch'

This commit is contained in:
Laurent Rineau 2018-03-26 11:03:37 +02:00
commit cd6fe20bd4
21 changed files with 202 additions and 154 deletions

View File

@ -12,15 +12,14 @@ need to provide a unique `id`-number. The policy parameter
`IdPolicy` offers several choices. The template parameters have to `IdPolicy` offers several choices. The template parameters have to
comply with the following requirements: comply with the following requirements:
<UL> \tparam NT is the number type for the box boundaries. It must meet the requierements
<LI>`NT`: number type for the box boundaries, needs to be a model of the concepts `Assignable` and `LessThanComparable`.
of the `Assignable` and the `LessThanComparable` concept. \tparam D is an integer and the dimension of the box.
<LI>`int D`: the dimension of the box. \tparam IdPolicy specifies how the `id`-number will be
<LI>`IdPolicy`: specifies how the `id`-number will be provided and can be one of the following types, where
provided. Can be one of the following types, where
`ID_EXPLICIT` is the default for this parameter: `ID_EXPLICIT` is the default for this parameter:
<UL> <UL>
<LI>`ID_NONE`: no `id`-number is provided. Can be useful <LI>`ID_NONE`: no `id`-number is provided. This can be useful
if `Box_d` is used as a base class for a different if `Box_d` is used as a base class for a different
implementation of `id`-numbers than the ones provided implementation of `id`-numbers than the ones provided
here. here.
@ -32,7 +31,7 @@ the old one, which is the behavior needed by the
`box_self_intersection_d()` algorithm. This is therefore `box_self_intersection_d()` algorithm. This is therefore
the safe default implementation. the safe default implementation.
<LI>`ID_FROM_BOX_ADDRESS`: casts the address of the box into a <LI>`ID_FROM_BOX_ADDRESS`: casts the address of the box into a
`std::ptrdiff_t` to create the `id`-number. Works fine `std::ptrdiff_t` to create the `id`-number. This works fine
if the intersection algorithms work effectively with pointers if the intersection algorithms work effectively with pointers
to boxes, but not in the case where the algorithms work with to boxes, but not in the case where the algorithms work with
box values, because the algorithms modify the order of the box values, because the algorithms modify the order of the
@ -40,7 +39,6 @@ boxes, and the `box_self_intersection_d()` algorithm
creates copies of the boxes that would not have identical creates copies of the boxes that would not have identical
`id`-numbers. `id`-numbers.
</UL> </UL>
</UL>
\cgalModels `BoxIntersectionBox_d` \cgalModels `BoxIntersectionBox_d`

View File

@ -16,11 +16,9 @@ the `Box_parameter` type required in the
`Box_parameter` to be of type `const B&`, while for the other `Box_parameter` to be of type `const B&`, while for the other
cases it just uses the pointer type. cases it just uses the pointer type.
<UL> \tparam BoxHandle is either a class type `B`, a pointer `B*`, or a
<LI>`BoxHandle`: either a class type `B`, a pointer `B*`, or a
const-pointer `const B*`, where `B` is a model of the const-pointer `const B*`, where `B` is a model of the
`BoxIntersectionBox_d` concept. `BoxIntersectionBox_d` concept.
</UL>
\cgalModels `BoxIntersectionTraits_d` \cgalModels `BoxIntersectionTraits_d`

View File

@ -19,9 +19,9 @@ of the `Assignable` and the `LessThanComparable` concept.
\tparam D the dimension of the box. \tparam D the dimension of the box.
\tparam Handle Handle concept, e.g., a pointer, an iterator, or a circulator. \tparam Handle Handle concept, e.g., a pointer, an iterator, or a circulator.
\tparam IdPolicy specifies how the `id`-number will be \tparam IdPolicy specifies how the `id`-number will be
provided. Can be one of the following types, where provided and can be one of the following types, where
`ID_FROM_HANDLE` is the default for this parameter: `ID_FROM_HANDLE` is the default for this parameter:
- `ID_NONE`: no `id`-number is provided. Can be useful - `ID_NONE`: no `id`-number is provided. This can be useful
to have this class as a base class for different to have this class as a base class for different
implementations of `id`-numbers than the ones provided implementations of `id`-numbers than the ones provided
here. here.
@ -33,7 +33,7 @@ provided. Can be one of the following types, where
`CGAL::box_self_intersection_d()` algorithm. This is therefore `CGAL::box_self_intersection_d()` algorithm. This is therefore
the safe default implementation. the safe default implementation.
- `ID_FROM_BOX_ADDRESS`: casts the address of the box into a - `ID_FROM_BOX_ADDRESS`: casts the address of the box into a
`std::ptrdiff_t` to create the `id`-number. Works fine `std::ptrdiff_t` to create the `id`-number. This works fine
if the intersection algorithms work effectively with pointers if the intersection algorithms work effectively with pointers
to boxes, but not in the case where the algorithms work with to boxes, but not in the case where the algorithms work with
box values, because the algorithms modify the order of the box values, because the algorithms modify the order of the

View File

@ -46,8 +46,26 @@ namespace CGAL {
An important special application of this algorithm is the test for An important special application of this algorithm is the test for
self-intersections where the second box sequence is an identical copy self-intersections where the second box sequence is an identical copy
of the first sequence including the preserved `id`-number. We of the first sequence including the preserved `id`-number. We
offer a specialized implementation offer a specialized implementation `box_self_intersection_all_pairs_d()`
`box_self_intersection_all_pairs` for this application. for this application.
\cgalHeading{Requirements}
<UL>
<LI>`ForwardIterator1`, and \f$ \ldots\f$ `2`, must meet
the requirements of `ForwardIterator` and both value types must be the same.
We call this value type `Box_handle` in the following.
<LI>`Callback` must be of the `BinaryFunction` concept.
The `Box_handle` must be convertible to both argument types. The
return type is not used and can be `void`.
<LI>The `Box_handle` must be a model of the `Assignable` concept.
<LI>In addition, if the default box traits is used the `Box_handle` must
be a class type `T` or a pointer to a class type `T`, where
`T` must be a model of the `BoxIntersectionBox_d` concept.
In both cases, the default box traits specializes to a suitable
implementation.
<LI>`BoxTraits` must be of the `BoxIntersectionTraits_d` concept.
</UL>
\sa \link PkgBoxIntersectionD_box_intersection_d `CGAL::box_intersection_d()` \endlink \sa \link PkgBoxIntersectionD_box_intersection_d `CGAL::box_intersection_d()` \endlink
\sa \link PkgBoxIntersectionD_box_self_intersection_d `CGAL::box_self_intersection_d()` \endlink \sa \link PkgBoxIntersectionD_box_self_intersection_d `CGAL::box_self_intersection_d()` \endlink
@ -63,6 +81,40 @@ namespace CGAL {
size of the second sequence. size of the second sequence.
*/ */
/*!
\ingroup PkgBoxIntersectionD_box_intersection_all_pairs_d
Invocation of box intersection with default box traits
`Box_intersection_d::Box_traits_d<Box_handle>`, where
`Box_handle` corresponds to the iterator value type of
`ForwardIterator1`.
*/
template< class ForwardIterator1,
class ForwardIterator2,
class Callback >
void box_intersection_all_pairs_d(
ForwardIterator1 begin1, ForwardIterator1 end1,
ForwardIterator2 begin2, ForwardIterator2 end2,
Callback callback,
CGAL::Box_intersection_d::Topology topology = CGAL::Box_intersection_d::CLOSED);
/*!
\ingroup PkgBoxIntersectionD_box_intersection_all_pairs_d
Invocation with custom box traits.
*/
template< class ForwardIterator1,
class ForwardIterator2,
class Callback, class BoxTraits >
void box_intersection_all_pairs_d(
ForwardIterator1 begin1, ForwardIterator1 end1,
ForwardIterator2 begin2, ForwardIterator2 end2,
Callback callback,
BoxTraits box_traits,
CGAL::Box_intersection_d::Topology topology = CGAL::Box_intersection_d::CLOSED);
/*! /*!
\addtogroup PkgBoxIntersectionD_box_intersection_d \addtogroup PkgBoxIntersectionD_box_intersection_d
@ -130,12 +182,16 @@ namespace CGAL {
values `Box_intersection_d::COMPLETE` and values `Box_intersection_d::COMPLETE` and
`Box_intersection_d::BIPARTITE`. `Box_intersection_d::BIPARTITE`.
\warning The two sequences of boxes passed to `box_intersection_d()` can be
ranges created from the same container, but these ranges must not contain
any common element.
\cgalHeading{Requirements} \cgalHeading{Requirements}
<UL> <UL>
<LI>`RandomAccessIterator1`, and \f$ \ldots\f$ `2`, must be <LI>`RandomAccessIterator1`, and \f$ \ldots\f$ `2`, must meet
mutable random-access iterators and both value types must be the requirements of `RandomAccessIterator` and both value types must be the same.
the same. We call this value type `Box_handle` in the following. We call this value type `Box_handle` in the following.
<LI>`Callback` must be of the `BinaryFunction` concept. <LI>`Callback` must be of the `BinaryFunction` concept.
The `Box_handle` must be convertible to both argument types. The The `Box_handle` must be convertible to both argument types. The
return type is not used and can be `void`. return type is not used and can be `void`.
@ -208,44 +264,6 @@ namespace CGAL {
*/ */
/*!
\ingroup PkgBoxIntersectionD_box_intersection_all_pairs_d
Invocation of box intersection with default box traits
`Box_intersection_d::Box_traits_d<Box_handle>`, where
`Box_handle` corresponds to the iterator value type of
`ForwardIterator1`.
*/
template< class ForwardIterator1,
class ForwardIterator2,
class Callback >
void box_intersection_all_pairs_d(
ForwardIterator1 begin1, ForwardIterator1 end1,
ForwardIterator2 begin2, ForwardIterator2 end2,
Callback callback,
CGAL::Box_intersection_d::Topology topology = CGAL::Box_intersection_d::CLOSED);
/*!
\ingroup PkgBoxIntersectionD_box_intersection_all_pairs_d
Invocation with custom box traits.
*/
template< class ForwardIterator1,
class ForwardIterator2,
class Callback, class BoxTraits >
void box_intersection_all_pairs_d(
ForwardIterator1 begin1, ForwardIterator1 end1,
ForwardIterator2 begin2, ForwardIterator2 end2,
Callback callback,
BoxTraits box_traits,
CGAL::Box_intersection_d::Topology topology = CGAL::Box_intersection_d::CLOSED);
} /* namespace CGAL */
namespace CGAL {
/*! /*!
\ingroup PkgBoxIntersectionD_box_intersection_d \ingroup PkgBoxIntersectionD_box_intersection_d
@ -297,7 +315,7 @@ namespace CGAL {
inferior to the fast `box_self_intersection_d()` algorithm. inferior to the fast `box_self_intersection_d()` algorithm.
The sequence of boxes is given with a forward iterator range. The The sequence of boxes is given with a forward iterator range. The
sequences are not modified. For each intersecting pair of boxes a sequence is not modified. For each intersecting pair of boxes a
`callback` function object is called with the two intersecting `callback` function object is called with the two intersecting
boxes as argument. boxes as argument.
@ -330,7 +348,7 @@ namespace CGAL {
\cgalHeading{Requirements} \cgalHeading{Requirements}
<UL> <UL>
<LI>`ForwardIterator` must be a forward iterator. We call its <LI>`ForwardIter` must meet the requirements of `ForwardIterator`. We call its
value type `Box_handle` in the following. value type `Box_handle` in the following.
<LI>`Callback` must be of the `BinaryFunction` concept. <LI>`Callback` must be of the `BinaryFunction` concept.
The `Box_handle` must be convertible to both argument types. The The `Box_handle` must be convertible to both argument types. The
@ -365,13 +383,11 @@ namespace CGAL {
Invocation of box intersection with default box traits Invocation of box intersection with default box traits
`Box_intersection_d::Box_traits_d<Box_handle>`, where `Box_intersection_d::Box_traits_d<Box_handle>`, where
`Box_handle` corresponds to the iterator value type of `Box_handle` corresponds to the iterator value type of
`ForwardIterator`. `ForwardIter`.
*/ */
template< class ForwardIterator, class Callback > template< class ForwardIter, class Callback >
void box_self_intersection_all_pairs_d( void box_self_intersection_all_pairs_d(
ForwardIterator begin, ForwardIterator end, ForwardIter begin, ForwardIter end,
Callback callback, Callback callback,
CGAL::Box_intersection_d::Topology topology = CGAL::Box_intersection_d::CLOSED); CGAL::Box_intersection_d::Topology topology = CGAL::Box_intersection_d::CLOSED);
@ -381,10 +397,10 @@ void box_self_intersection_all_pairs_d(
*/ */
template< class ForwardIterator, template< class ForwardIter,
class Callback, class BoxTraits > class Callback, class BoxTraits >
void box_self_intersection_all_pairs_d( void box_self_intersection_all_pairs_d(
ForwardIterator begin, ForwardIterator end, ForwardIter begin, ForwardIter end,
Callback callback, Callback callback,
BoxTraits box_traits, BoxTraits box_traits,
CGAL::Box_intersection_d::Topology topology = CGAL::Box_intersection_d::CLOSED); CGAL::Box_intersection_d::Topology topology = CGAL::Box_intersection_d::CLOSED);
@ -433,14 +449,15 @@ namespace CGAL {
In addition, a box has a unique `id`-number. It is used to order In addition, a box has a unique `id`-number. It is used to order
boxes consistently in each dimension even if boxes have identical boxes consistently in each dimension even if boxes have identical
coordinates. In consequence, the algorithm guarantees that a pair of coordinates. In consequence, the algorithm guarantees that a pair of
intersecting boxes is reported only once. This self-intersection intersecting boxes is reported only once. Boxes of equal
function creates internally a second copy of the box sequence. The
copying has to preserve the `id`-number of boxes. Note that this
implies that the address of the box is not sufficient for the
`id`-number if boxes are copied by value. Boxes of equal
`id`-number are not reported as intersecting pairs since they are `id`-number are not reported as intersecting pairs since they are
always intersecting trivially. always intersecting trivially.
\warning This self-intersection function creates internally a second copy
of the box sequence. Note that this implies that an `id`-number based on the address
of the box is not acceptable if boxes are copied by value and one must either
pass boxes by pointer or use another type of box `id`-number such as `ID_EXPLICIT`.
The algorithm uses a traits class of the `BoxIntersectionTraits_d` The algorithm uses a traits class of the `BoxIntersectionTraits_d`
concept to access the boxes. A default traits class is provided that concept to access the boxes. A default traits class is provided that
assumes that the box type is a model of the `BoxIntersectionBox_d` assumes that the box type is a model of the `BoxIntersectionBox_d`

View File

@ -8,6 +8,7 @@ functions to the dimension, the `id`-number, and the boundaries of
the boxes manipulated in these algorithms. the boxes manipulated in these algorithms.
\cgalRefines `Assignable` \cgalRefines `Assignable`
\cgalRefines `DefaultConstructible`
\cgalHasModel CGAL::Box_intersection_d::Box_traits_d \cgalHasModel CGAL::Box_intersection_d::Box_traits_d

View File

@ -181,13 +181,17 @@ template< class RandomAccessIter, class Callback, class BoxTraits >
void box_self_intersection_d( void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end, RandomAccessIter begin, RandomAccessIter end,
Callback callback, Callback callback,
BoxTraits box_traits) BoxTraits box_traits,
std::ptrdiff_t cutoff,
Box_intersection_d::Topology topology)
{ {
// Copying rather than calling 'box_intersection_d(begin, end, begin, end, ...'
// is necessary because the 'std::partition' and range splits on the first range
// would be messed up by sorts on the second range otherwise.
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t; typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
std::vector< val_t> i( begin, end); std::vector< val_t> i( begin, end);
box_intersection_d( begin, end, i.begin(), i.end(), box_intersection_d( begin, end, i.begin(), i.end(),
callback, box_traits, 10, callback, box_traits, cutoff, topology,
Box_intersection_d::CLOSED,
Box_intersection_d::COMPLETE); Box_intersection_d::COMPLETE);
} }
@ -198,26 +202,17 @@ void box_self_intersection_d(
BoxTraits box_traits, BoxTraits box_traits,
std::ptrdiff_t cutoff) std::ptrdiff_t cutoff)
{ {
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t; return box_self_intersection_d(begin, end, callback, box_traits, cutoff,
std::vector< val_t> i( begin, end); Box_intersection_d::CLOSED);
box_intersection_d( begin, end, i.begin(), i.end(),
callback, box_traits, cutoff,
Box_intersection_d::CLOSED,
Box_intersection_d::COMPLETE);
} }
template< class RandomAccessIter, class Callback, class BoxTraits > template< class RandomAccessIter, class Callback, class BoxTraits >
void box_self_intersection_d( void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end, RandomAccessIter begin, RandomAccessIter end,
Callback callback, Callback callback,
BoxTraits box_traits, BoxTraits box_traits)
std::ptrdiff_t cutoff,
Box_intersection_d::Topology topology)
{ {
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t; return box_self_intersection_d(begin, end, callback, box_traits, 10);
std::vector< val_t> i( begin, end);
box_intersection_d( begin, end, i.begin(), i.end(),
callback, box_traits, cutoff, topology, Box_intersection_d::COMPLETE);
} }
// Specialized call with default box traits, specialized for self-intersection. // Specialized call with default box traits, specialized for self-intersection.
@ -229,20 +224,18 @@ void box_self_intersection_d(
{ {
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t; typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits; typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_self_intersection_d(begin, end, callback, box_self_intersection_d(begin, end, callback, Box_traits());
Box_traits(), 10, Box_intersection_d::CLOSED);
} }
template< class RandomAccessIter, class Callback > template< class RandomAccessIter, class Callback >
void box_self_intersection_d( void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end, RandomAccessIter begin, RandomAccessIter end,
Callback callback, Callback callback,
std::ptrdiff_t) std::ptrdiff_t cutoff)
{ {
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t; typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits; typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_self_intersection_d(begin, end, callback, box_self_intersection_d(begin, end, callback, Box_traits(), cutoff);
Box_traits(), 10, Box_intersection_d::CLOSED);
} }
template< class RandomAccessIter, class Callback > template< class RandomAccessIter, class Callback >

View File

@ -116,7 +116,7 @@ void test_box_intersection() {
std::ptrdiff_t(1), std::ptrdiff_t(1),
CGAL::Box_intersection_d::HALF_OPEN, CGAL::Box_intersection_d::HALF_OPEN,
CGAL::Box_intersection_d::COMPLETE); CGAL::Box_intersection_d::COMPLETE);
check_result( "Box self inters. 3x3+2, half-open", result, check5, 2); check_result( "Box inters. 3x3+2, half-open", result, check5, 2);
// compare this with the bipartite case // compare this with the bipartite case
// self intersect 3x3+2 query boxes, half-open boxes // self intersect 3x3+2 query boxes, half-open boxes

View File

@ -1763,10 +1763,10 @@ namespace CartesianKernelFunctors {
// to avoid badly defined vectors with coordinates all close // to avoid badly defined vectors with coordinates all close
// to 0 when the plane is almost horizontal, we ignore the // to 0 when the plane is almost horizontal, we ignore the
// smallest coordinate instead of always ignoring Z // smallest coordinate instead of always ignoring Z
if (CGAL::possibly(CGAL_AND (a <= b, a <= c))) if (a <= b && a <= c)
return Vector_3(FT(0), -h.c(), h.b()); return Vector_3(FT(0), -h.c(), h.b());
if (CGAL::possibly(CGAL_AND (b <= a, b <= c))) if (b <= a && b <= c)
return Vector_3(-h.c(), FT(0), h.a()); return Vector_3(-h.c(), FT(0), h.a());
return Vector_3(-h.b(), h.a(), FT(0)); return Vector_3(-h.b(), h.a(), FT(0));

View File

@ -273,9 +273,9 @@ point_on_planeC3(const FT &pa, const FT &pb, const FT &pc, const FT &pd,
// to avoid badly defined point with an overly large coordinate when // to avoid badly defined point with an overly large coordinate when
// the plane is almost orthogonal to one axis, we use the largest // the plane is almost orthogonal to one axis, we use the largest
// scalar coordinate instead of always using the first non-null // scalar coordinate instead of always using the first non-null
if (CGAL::possibly(CGAL_AND (abs_pa >= abs_pb, abs_pa >= abs_pc))) if (abs_pa >= abs_pb && abs_pa >= abs_pc)
x = -pd/pa; x = -pd/pa;
else if (CGAL::possibly(CGAL_AND (abs_pb >= abs_pa, abs_pb >= abs_pc))) else if (abs_pb >= abs_pa && abs_pb >= abs_pc)
y = -pd/pb; y = -pd/pb;
else else
z = -pd/pc; z = -pd/pc;

View File

@ -155,12 +155,6 @@ Returns the number of vertices which are corners of the complex.
*/ */
size_type number_of_corners() const; size_type number_of_corners() const;
/*!
Returns the number of vertices which are corners of the complex with index `index`.
*/
size_type number_of_corners(Corner_index index) const;
/*! /*!
Returns `true` Returns `true`
iff edge `e` belongs to some curve. iff edge `e` belongs to some curve.

View File

@ -292,6 +292,10 @@ public:
{ {
return corners_.size(); return corners_.size();
} }
size_type number_of_corners() const
{
return corners_.size();
}
void rescan_after_load_of_triangulation(); void rescan_after_load_of_triangulation();

View File

@ -137,6 +137,8 @@ bool is_simple_2(ForwardIterator first,
ForwardIterator last, ForwardIterator last,
const PolygonTraits& traits) const PolygonTraits& traits)
{ {
if (first == last) return true;
return is_simple_polygon(first, last, traits); return is_simple_polygon(first, last, traits);
} }

View File

@ -161,6 +161,9 @@ void test_polygon(const R&, const Point&, const char* FileName)
cout << "the orientation is collinear" << endl; cout << "the orientation is collinear" << endl;
break; break;
} }
polygon.clear();
assert(CGAL::is_convex_2(polygon.begin(), polygon.end()));
} }
//-----------------------------------------------------------------------// //-----------------------------------------------------------------------//

View File

@ -63,6 +63,9 @@ void TestDegenerateCases()
polygon.push_back(Point(1,2)); polygon.push_back(Point(1,2));
assert(CGAL::is_simple_2(polygon.begin(), polygon.end())); assert(CGAL::is_simple_2(polygon.begin(), polygon.end()));
polygon.clear();
assert(CGAL::is_simple_2(polygon.begin(), polygon.end()));
} }
int main() int main()

View File

@ -80,7 +80,7 @@ struct Intersect_coplanar_faces_3{
//constructor for intersection of edges. prev and curr are two points on an edge of the first facet (preserving the //constructor for intersection of edges. prev and curr are two points on an edge of the first facet (preserving the
//orientation of the facet). This edge is intersected by h2 from the second facet. //orientation of the facet). This edge is intersected by h2 from the second facet.
// //
//The rational is the following: we first check whether curr and prev are on the same edge. I so we create //The rational is the following: we first check whether curr and prev are on the same edge. If so we create
//an intersection point between two edges. Otherwise, the point is a vertex of the second facet included into //an intersection point between two edges. Otherwise, the point is a vertex of the second facet included into
//the first facet. //the first facet.
// //
@ -103,10 +103,26 @@ struct Intersect_coplanar_faces_3{
res.info_2=h2; res.info_2=h2;
if (ipt_prev.type_1==ON_VERTEX && next(ipt_prev.info_1, tm1) == ipt_curr.info_1){ if (ipt_prev.type_1==ON_VERTEX && next(ipt_prev.info_1, tm1) == ipt_curr.info_1){
CGAL_assertion(ipt_curr.type_1!=ON_FACE); if(ipt_curr.type_1!=ON_FACE)
{
res.type_1=ON_EDGE; res.type_1=ON_EDGE;
res.info_1=ipt_curr.info_1; res.info_1=ipt_curr.info_1;
} }
else
{
CGAL_assertion( ipt_curr.type_2==ON_VERTEX);
res.type_1=ON_FACE;
res.info_1=h1;
res.type_2=ON_VERTEX;
typename Exact_kernel::Collinear_3 is_collinear = Exact_kernel().collinear_3_object();
if ( !is_collinear(ipt_prev.point,ipt_curr.point,to_exact(get(vpm2,target(res.info_2,tm2)) ) ) ){
res.info_2=prev(res.info_2,tm2);
CGAL_assertion( is_collinear(ipt_prev.point,ipt_curr.point,to_exact(get(vpm2,target(res.info_2,tm2))) ) );
}
res.point = to_exact( get(vpm2, target(res.info_2,tm2)) );
return res;
}
}
else{ else{
if(ipt_curr.type_1==ON_VERTEX && ipt_prev.info_1 == ipt_curr.info_1){ if(ipt_curr.type_1==ON_VERTEX && ipt_prev.info_1 == ipt_curr.info_1){
CGAL_assertion(ipt_prev.type_1!=ON_FACE); CGAL_assertion(ipt_prev.type_1!=ON_FACE);

View File

@ -0,0 +1,6 @@
OFF
3 1 0
0 5310 100
0 5400 100
0 5310 150
3 0 2 1

View File

@ -0,0 +1,6 @@
OFF
3 1 0
0 5375 105
0 5350 110
0 5375 110
3 1 2 0

View File

@ -64,6 +64,7 @@ data-coref/coplanar_triangles/all_cases/deg/tr15-1.off data-coref/coplanar_trian
data-coref/coplanar_triangles/all_cases/deg/tr16-1.off data-coref/coplanar_triangles/all_cases/deg/tr16-2.off data-coref/coplanar_triangles/all_cases/deg/tr16-1.off data-coref/coplanar_triangles/all_cases/deg/tr16-2.off
data-coref/coplanar_triangles/all_cases/deg/tr17-1.off data-coref/coplanar_triangles/all_cases/deg/tr17-2.off data-coref/coplanar_triangles/all_cases/deg/tr17-1.off data-coref/coplanar_triangles/all_cases/deg/tr17-2.off
data-coref/coplanar_triangles/all_cases/bugreport/tr1-1.off data-coref/coplanar_triangles/all_cases/bugreport/tr1-2.off data-coref/coplanar_triangles/all_cases/bugreport/tr1-1.off data-coref/coplanar_triangles/all_cases/bugreport/tr1-2.off
data-coref/coplanar_triangles/all_cases/bugreport/tr2-1.off data-coref/coplanar_triangles/all_cases/bugreport/tr2-2.off
data-coref/coplanar_triangles/all_cases/tr1-1.off data-coref/coplanar_triangles/all_cases/tr1-2.off data-coref/coplanar_triangles/all_cases/tr1-1.off data-coref/coplanar_triangles/all_cases/tr1-2.off
data-coref/coplanar_triangles/all_cases/tr2-1.off data-coref/coplanar_triangles/all_cases/tr2-2.off data-coref/coplanar_triangles/all_cases/tr2-1.off data-coref/coplanar_triangles/all_cases/tr2-2.off
data-coref/coplanar_triangles/all_cases/tr3-1.off data-coref/coplanar_triangles/all_cases/tr3-2.off data-coref/coplanar_triangles/all_cases/tr3-1.off data-coref/coplanar_triangles/all_cases/tr3-2.off

View File

@ -10,20 +10,19 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Surface_mesh<K::Point_3> Surface_mesh; typedef CGAL::Surface_mesh<K::Point_3> Surface_mesh;
typedef CGAL::Polyhedron_3<K> Polyhedron_3; typedef CGAL::Polyhedron_3<K> Polyhedron_3;
int main(int argc, char** argv)
void test(const char* f1, const char* f2)
{ {
for(int i=0; i< (argc-1)/2;++i) std::cout << "Corefining " << f1
{ << " and " << f2 << "\n";
std::cout << "Corefining " << argv[2*i+1]
<< " and " << argv[2*(i+1)] << "\n";
std::cout << " with Surface_mesh\n"; std::cout << " with Surface_mesh\n";
Surface_mesh sm1, sm2; Surface_mesh sm1, sm2;
std::ifstream input(argv[2*i+1]); std::ifstream input(f1);
assert(input); assert(input);
input >> sm1; input >> sm1;
input.close(); input.close();
input.open(argv[2*(i+1)]); input.open(f2);
assert(input); assert(input);
input >> sm2; input >> sm2;
input.close(); input.close();
@ -35,11 +34,11 @@ int main(int argc, char** argv)
std::cout << " with Polyhedron_3\n"; std::cout << " with Polyhedron_3\n";
Polyhedron_3 P, Q; Polyhedron_3 P, Q;
input.open(argv[2*i+1]); input.open(f1);
assert(input); assert(input);
input >> P; input >> P;
input.close(); input.close();
input.open(argv[2*(i+1)]); input.open(f2);
assert(input); assert(input);
input >> Q; input >> Q;
@ -48,4 +47,11 @@ int main(int argc, char** argv)
assert(P.is_valid()); assert(P.is_valid());
assert(Q.is_valid()); assert(Q.is_valid());
} }
int main(int argc, char** argv)
{
for(int i=0; i< (argc-1)/2;++i)
{
test(argv[2*i+1], argv[2*(i+1)]);
test(argv[2*(i+1)], argv[2*i+1]);
}
} }

View File

@ -389,7 +389,7 @@ public:
// Insert "num_points_seq" points sequentially // Insert "num_points_seq" points sequentially
// (or more if dim < 3 after that) // (or more if dim < 3 after that)
size_t num_points_seq = (std::min)(num_points, (size_t)100); size_t num_points_seq = (std::min)(num_points, (size_t)100);
while (dimension() < 3 || i < num_points_seq) while (i < num_points_seq || (dimension() < 3 && i < num_points))
{ {
hint = insert(points[i], hint); hint = insert(points[i], hint);
++i; ++i;
@ -472,7 +472,7 @@ private:
// Insert "num_points_seq" points sequentially // Insert "num_points_seq" points sequentially
// (or more if dim < 3 after that) // (or more if dim < 3 after that)
size_t num_points_seq = (std::min)(num_points, (size_t)100); size_t num_points_seq = (std::min)(num_points, (size_t)100);
while (dimension() < 3 || i < num_points_seq) while (i < num_points_seq || (dimension() < 3 && i < num_points))
{ {
hint = insert(points[indices[i]], hint); hint = insert(points[indices[i]], hint);
if (hint != Vertex_handle()) hint->info() = infos[indices[i]]; if (hint != Vertex_handle()) hint->info() = infos[indices[i]];

View File

@ -361,7 +361,7 @@ namespace CGAL {
// Insert "num_points_seq" points sequentially // Insert "num_points_seq" points sequentially
// (or more if dim < 3 after that) // (or more if dim < 3 after that)
size_t num_points_seq = (std::min)(num_points, (size_t)100); size_t num_points_seq = (std::min)(num_points, (size_t)100);
while (dimension() < 3 || i < num_points_seq) while (i < num_points_seq || (dimension() < 3 && i < num_points))
{ {
Locate_type lt; Locate_type lt;
Cell_handle c; Cell_handle c;
@ -484,7 +484,7 @@ namespace CGAL {
// Insert "num_points_seq" points sequentially // Insert "num_points_seq" points sequentially
// (or more if dim < 3 after that) // (or more if dim < 3 after that)
size_t num_points_seq = (std::min)(num_points, (size_t)100); size_t num_points_seq = (std::min)(num_points, (size_t)100);
while (dimension() < 3 || i < num_points_seq) while (i < num_points_seq || (dimension() < 3 && i < num_points))
{ {
Locate_type lt; Locate_type lt;
Cell_handle c; Cell_handle c;