Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] patch: inserting points with info in Periodic_3_Delaunay_triangulation_3

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] patch: inserting points with info in Periodic_3_Delaunay_triangulation_3


Chronological Thread 
  • From: Jakob van Bethlehem <>
  • To:
  • Subject: Re: [cgal-discuss] patch: inserting points with info in Periodic_3_Delaunay_triangulation_3
  • Date: Fri, 02 Mar 2012 17:13:44 +0100

Hej,

Following up yet again, I found a minor problem in my patch for
Periodic_3_triangulation_3.h. That patch should be replaced with the attached
version.
(btw, these are patches against the 3.9 release version, which I tried to
message across by adding the '-3.9' postfix)

Sincerely,
Jakob van Bethlehem


On 03/01/2012 06:10 PM, Jakob van Bethlehem wrote:
Hello,

Following up on my question earlier today, I created patches the allow
insertion of vertices with info into a Periodic_3_Delaunay_triangulation_3
from eg a vector of such vertices. I'm not sure what
is the custom when posting patches, but I created a separate patch for both
files involved: Periodic_3_triangulation_3.h and
Periodic_3_Delaunay_triangulation_3.h. Also it is not purely a patch that
adds the new functionality:

* there was a minor issue in the normal insert(InputIterator, InputIterator)
routine in Periodic_3_Delaunay_triangulation_3: points already inserted from
the 'points' vector during an initial
insertion were re-inserted during the insert_in_conflict() call.
* the special 'is_large_point_set' value, IMHO, should also be present in the
constructor, passing that value on to the call to insert()
* the new functionality of inserting points with info: I followed the same
procedure as in Delaunay_triangulation_3.h and didn't have to invent anything
'new'.

Some other thoughts that came up while working on this:
- Why is this 'insert-with-info' routine only defined in the
Delaunay-classes? I wasn't able to find any reason why the exact same
function wouldn't work in the respective parent classes
Triangulation_3 and Periodic_3_triangulation_3
- When the insert_with_info() routines get presented with the (unfortunate)
situation that 'is_large_point_set==true', but the input set is actually
small, it will result in a SegmentationFault
somehow. I haven't been able to figure out why this happens, but it seems to
me that this is not the wanted outcome :P I may have some time later to have
a look at this, but since in my application
this situation will not occur, unfortunately it will probably end up pretty
low on my priority list.

Sincerely,
Jakob van Bethlehem





868,872c868,874
< template < class InputIterator, class Conflict_tester,
< class Point_hider>
< std::vector<Vertex_handle> insert_in_conflict(
< InputIterator begin, InputIterator end, Cell_handle start,
< Conflict_tester &tester, Point_hider &hider) {
---
> template < class InputIterator, class Conflict_tester, class Point_hider>
> std::vector<Vertex_handle>
> insert_in_conflict(InputIterator begin, InputIterator end,
> Cell_handle start,
> Conflict_tester &tester,
> Point_hider &hider)
> {
887,889c889,891
< CGAL_triangulation_assertion(lta == lt);
< CGAL_triangulation_assertion(ia == li);
< CGAL_triangulation_assertion(ja == lj);
---
> CGAL_triangulation_assertion(lta == lt);
> CGAL_triangulation_assertion(ia == li);
> CGAL_triangulation_assertion(ja == lj);
898a901,945
>
> #ifndef CGAL_TRIANGULATION_3_DONT_INSERT_RANGE_OF_POINTS_WITH_INFO
> template <class IndexIterator, class InfoType, class Conflict_tester,
> class Point_hider>
> std::vector<Vertex_handle>
> insert_in_conflict_with_info(IndexIterator begin,
> IndexIterator end,
> std::vector<Point> const &points,
> std::vector<InfoType> const &info,
> Cell_handle start,
> Conflict_tester &tester, Point_hider &hider)
> {
> Vertex_handle new_vertex;
> Cell_handle hint;
> std::vector<Vertex_handle> double_vertices;
> Locate_type lt = Locate_type();
> int li=0, lj=0;
> CGAL_triangulation_assertion_code( Locate_type lta = Locate_type(); )
> CGAL_triangulation_assertion_code( int ia = 0; )
> CGAL_triangulation_assertion_code( int ja = 0; )
> while (begin != end)
> {
> tester.set_point(points[*begin]);
> hint = periodic_locate(points[*begin], Offset(), lt, li, lj, start);
> CGAL_triangulation_assertion_code( if (number_of_vertices() != 0) { );
> CGAL_triangulation_assertion(
> side_of_cell(points[*begin], Offset(), hint, lta, ia, ja) !=
> ON_UNBOUNDED_SIDE);
> CGAL_triangulation_assertion(lta == lt);
> CGAL_triangulation_assertion(ia == li);
> CGAL_triangulation_assertion(ja == lj);
> CGAL_triangulation_assertion_code( });
>
> new_vertex = insert_in_conflict(points[*begin], lt, hint, li, lj,
> tester, hider);
> // couple info independent of the value of lt; if it happens to be a
> double
> // with one of previously created dummy points, it will not be
> removed later, so
> // the info must be added
> if (new_vertex != Vertex_handle())
> new_vertex->info() = info[*begin];
> if (lt == VERTEX) double_vertices.push_back(new_vertex);
> start = new_vertex->cell();
> ++begin;
> }
> return double_vertices;
> }
>
> #endif



Archive powered by MHonArc 2.6.16.

Top of Page