mirror of https://github.com/CGAL/cgal
- New function insert(Point, Locate_type, Cell_handle, int, int).
This commit is contained in:
parent
858f561d00
commit
56692ce622
|
|
@ -1,5 +1,6 @@
|
|||
Version 1.105 (?? February 02)
|
||||
- Shorten DS_Container::Free_elt so that TDS_2 can use it.
|
||||
- New insert(Point, Locate_type, Cell_handle, int, int).
|
||||
|
||||
Version 1.104 (5 February 02)
|
||||
- Various internal cleanups.
|
||||
|
|
|
|||
|
|
@ -81,6 +81,13 @@ triangulations.
|
|||
addition the empty sphere property of all the created faces.
|
||||
The optional argument \ccc{start} is used as a starting place for the search.}
|
||||
|
||||
\ccMethod{Vertex_handle insert(const Point & p, Locate_type lt,
|
||||
Cell_handle loc, int li, int lj);}
|
||||
{Inserts point \ccc{p} in the triangulation and returns the corresponding
|
||||
vertex. Similar to the above \ccc{insert()} function, but takes as additional
|
||||
parameter the return values of a previous location query. See description of
|
||||
\ccc{locate()} above.}
|
||||
|
||||
The following method allows one to insert several points. It returns the
|
||||
number of inserted points.
|
||||
|
||||
|
|
@ -91,21 +98,6 @@ number of inserted points.
|
|||
\ccc{last}$\left.\right)$.
|
||||
\ccPrecond{The \ccc{value_type} of \ccc{first} and \ccc{last} is
|
||||
\ccc{Point}.}}
|
||||
%\ccMethod{int insert(list<Point>::const_iterator first,
|
||||
% list<Point>::const_iterator last);}
|
||||
%{}
|
||||
%\ccGlue
|
||||
%\ccMethod{int insert(vector<Point>::const_iterator first,
|
||||
% vector<Point>::const_iterator last);}
|
||||
%{}
|
||||
%\ccGlue
|
||||
%\ccMethod{int insert(istream_iterator<Point, ptrdiff_t> first,
|
||||
% istream_iterator<Point, ptrdiff_t> last);}
|
||||
%{}
|
||||
%\ccGlue
|
||||
%\ccMethod{int insert(Point* first,
|
||||
% Point* last);}
|
||||
%{}
|
||||
|
||||
\ccHeading{Removal}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,13 @@ insertion creates a vertex, this vertex is returned. Otherwise, this
|
|||
method returns \ccc{NULL}.
|
||||
The optional argument \ccc{start} is used as a starting place for the search.}
|
||||
|
||||
\ccMethod{Vertex_handle insert(const Weighted_point & p, Locate_type lt,
|
||||
Cell_handle loc, int li, int lj);}
|
||||
{Inserts point \ccc{p} in the triangulation and returns the corresponding
|
||||
vertex. Similar to the above \ccc{insert()} function, but takes as additional
|
||||
parameter the return values of a previous location query. See description of
|
||||
\ccc{locate()} above.}
|
||||
|
||||
The following method allows one to insert several points. It returns the
|
||||
number of inserted points.
|
||||
|
||||
|
|
|
|||
|
|
@ -564,6 +564,13 @@ triangulate the new infinite face. See
|
|||
Figure~\ref{Triangulation3-fig-insert_outside_affine_hull}.
|
||||
The optional argument \ccc{start} is used as a starting place for the search.}
|
||||
|
||||
\ccMethod{Vertex_handle insert(const Point & p, Locate_type lt,
|
||||
Cell_handle loc, int li, int lj);}
|
||||
{Inserts point \ccc{p} in the triangulation and returns the corresponding
|
||||
vertex. Similar to the above \ccc{insert()} function, but takes as additional
|
||||
parameter the return values of a previous location query. See description of
|
||||
\ccc{locate()} above.}
|
||||
|
||||
\ccMethod{template < class InputIterator >
|
||||
int
|
||||
insert(InputIterator first, InputIterator last);}
|
||||
|
|
|
|||
|
|
@ -81,6 +81,13 @@ triangulations.
|
|||
addition the empty sphere property of all the created faces.
|
||||
The optional argument \ccc{start} is used as a starting place for the search.}
|
||||
|
||||
\ccMethod{Vertex_handle insert(const Point & p, Locate_type lt,
|
||||
Cell_handle loc, int li, int lj);}
|
||||
{Inserts point \ccc{p} in the triangulation and returns the corresponding
|
||||
vertex. Similar to the above \ccc{insert()} function, but takes as additional
|
||||
parameter the return values of a previous location query. See description of
|
||||
\ccc{locate()} above.}
|
||||
|
||||
The following method allows one to insert several points. It returns the
|
||||
number of inserted points.
|
||||
|
||||
|
|
@ -91,21 +98,6 @@ number of inserted points.
|
|||
\ccc{last}$\left.\right)$.
|
||||
\ccPrecond{The \ccc{value_type} of \ccc{first} and \ccc{last} is
|
||||
\ccc{Point}.}}
|
||||
%\ccMethod{int insert(list<Point>::const_iterator first,
|
||||
% list<Point>::const_iterator last);}
|
||||
%{}
|
||||
%\ccGlue
|
||||
%\ccMethod{int insert(vector<Point>::const_iterator first,
|
||||
% vector<Point>::const_iterator last);}
|
||||
%{}
|
||||
%\ccGlue
|
||||
%\ccMethod{int insert(istream_iterator<Point, ptrdiff_t> first,
|
||||
% istream_iterator<Point, ptrdiff_t> last);}
|
||||
%{}
|
||||
%\ccGlue
|
||||
%\ccMethod{int insert(Point* first,
|
||||
% Point* last);}
|
||||
%{}
|
||||
|
||||
\ccHeading{Removal}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,13 @@ insertion creates a vertex, this vertex is returned. Otherwise, this
|
|||
method returns \ccc{NULL}.
|
||||
The optional argument \ccc{start} is used as a starting place for the search.}
|
||||
|
||||
\ccMethod{Vertex_handle insert(const Weighted_point & p, Locate_type lt,
|
||||
Cell_handle loc, int li, int lj);}
|
||||
{Inserts point \ccc{p} in the triangulation and returns the corresponding
|
||||
vertex. Similar to the above \ccc{insert()} function, but takes as additional
|
||||
parameter the return values of a previous location query. See description of
|
||||
\ccc{locate()} above.}
|
||||
|
||||
The following method allows one to insert several points. It returns the
|
||||
number of inserted points.
|
||||
|
||||
|
|
|
|||
|
|
@ -564,6 +564,13 @@ triangulate the new infinite face. See
|
|||
Figure~\ref{Triangulation3-fig-insert_outside_affine_hull}.
|
||||
The optional argument \ccc{start} is used as a starting place for the search.}
|
||||
|
||||
\ccMethod{Vertex_handle insert(const Point & p, Locate_type lt,
|
||||
Cell_handle loc, int li, int lj);}
|
||||
{Inserts point \ccc{p} in the triangulation and returns the corresponding
|
||||
vertex. Similar to the above \ccc{insert()} function, but takes as additional
|
||||
parameter the return values of a previous location query. See description of
|
||||
\ccc{locate()} above.}
|
||||
|
||||
\ccMethod{template < class InputIterator >
|
||||
int
|
||||
insert(InputIterator first, InputIterator last);}
|
||||
|
|
|
|||
|
|
@ -201,6 +201,9 @@ public:
|
|||
|
||||
Vertex_handle insert(const Point & p, Cell_handle start = NULL);
|
||||
|
||||
Vertex_handle insert(const Point & p, Locate_type lt,
|
||||
Cell_handle c, int li, int);
|
||||
|
||||
// Obsolete.
|
||||
Vertex_handle push_back(const Point & p)
|
||||
{
|
||||
|
|
@ -372,13 +375,21 @@ template < class Gt, class Tds >
|
|||
typename Delaunay_triangulation_3<Gt,Tds>::Vertex_handle
|
||||
Delaunay_triangulation_3<Gt,Tds>::
|
||||
insert(const Point & p, Cell_handle start)
|
||||
{
|
||||
Locate_type lt;
|
||||
int li, lj;
|
||||
Cell_handle c = locate(p, lt, li, lj, start);
|
||||
return insert(p, lt, c, li, lj);
|
||||
}
|
||||
|
||||
template < class Gt, class Tds >
|
||||
typename Delaunay_triangulation_3<Gt,Tds>::Vertex_handle
|
||||
Delaunay_triangulation_3<Gt,Tds>::
|
||||
insert(const Point & p, Locate_type lt, Cell_handle c, int li, int)
|
||||
{
|
||||
switch (dimension()) {
|
||||
case 3:
|
||||
{
|
||||
Locate_type lt;
|
||||
int li, lj;
|
||||
Cell_handle c = locate( p, lt, li, lj, start);
|
||||
if ( lt == VERTEX )
|
||||
return c->vertex(li);
|
||||
|
||||
|
|
@ -389,9 +400,6 @@ insert(const Point & p, Cell_handle start)
|
|||
}// dim 3
|
||||
case 2:
|
||||
{
|
||||
Locate_type lt;
|
||||
int li, lj;
|
||||
Cell_handle c = locate( p, lt, li, lj, start);
|
||||
switch (lt) {
|
||||
case OUTSIDE_CONVEX_HULL:
|
||||
case CELL:
|
||||
|
|
@ -413,9 +421,9 @@ insert(const Point & p, Cell_handle start)
|
|||
}//dim 2
|
||||
default :
|
||||
// dimension <= 1
|
||||
return Tr_Base::insert(p,start);
|
||||
return Tr_Base::insert(p, c);
|
||||
}
|
||||
}// insert(p)
|
||||
}
|
||||
|
||||
template < class Gt, class Tds >
|
||||
void
|
||||
|
|
|
|||
|
|
@ -95,7 +95,10 @@ public:
|
|||
return number_of_vertices() - n;
|
||||
}
|
||||
|
||||
Vertex_handle insert( const Weighted_point & p, Cell_handle start = NULL);
|
||||
Vertex_handle insert(const Weighted_point & p, Cell_handle start = NULL);
|
||||
|
||||
Vertex_handle insert(const Weighted_point & p, Locate_type lt,
|
||||
Cell_handle c, int li, int);
|
||||
|
||||
Vertex_handle push_back(const Weighted_point &p)
|
||||
{
|
||||
|
|
@ -353,14 +356,21 @@ template < class Gt, class Tds >
|
|||
typename Regular_triangulation_3<Gt,Tds>::Vertex_handle
|
||||
Regular_triangulation_3<Gt,Tds>::
|
||||
insert(const Weighted_point & p, Cell_handle start)
|
||||
{
|
||||
Locate_type lt;
|
||||
int li, lj;
|
||||
Cell_handle c = locate(p, lt, li, lj, start);
|
||||
return insert(p, lt, c, li, lj);
|
||||
}
|
||||
|
||||
template < class Gt, class Tds >
|
||||
typename Regular_triangulation_3<Gt,Tds>::Vertex_handle
|
||||
Regular_triangulation_3<Gt,Tds>::
|
||||
insert(const Weighted_point & p, Locate_type lt, Cell_handle c, int li, int)
|
||||
{
|
||||
switch (dimension()) {
|
||||
case 3:
|
||||
{
|
||||
Locate_type lt;
|
||||
int li, lj;
|
||||
Cell_handle c = locate( p, lt, li, lj, start);
|
||||
|
||||
if ( lt == VERTEX )
|
||||
return c->vertex(li);
|
||||
// choice: not to do anything
|
||||
|
|
@ -389,9 +399,6 @@ insert(const Weighted_point & p, Cell_handle start)
|
|||
}
|
||||
case 2:
|
||||
{
|
||||
Locate_type lt;
|
||||
int li, lj;
|
||||
Cell_handle c = locate( p, lt, li, lj, start);
|
||||
switch (lt) {
|
||||
case OUTSIDE_CONVEX_HULL:
|
||||
case CELL:
|
||||
|
|
@ -429,9 +436,6 @@ insert(const Weighted_point & p, Cell_handle start)
|
|||
}//dim 2
|
||||
case 1:
|
||||
{
|
||||
Locate_type lt;
|
||||
int li, lj;
|
||||
Cell_handle c = locate( p, lt, li, lj, start);
|
||||
switch (lt) {
|
||||
case OUTSIDE_CONVEX_HULL:
|
||||
case EDGE:
|
||||
|
|
@ -488,7 +492,7 @@ insert(const Weighted_point & p, Cell_handle start)
|
|||
}
|
||||
default :
|
||||
{
|
||||
return Tr_Base::insert(p,start);
|
||||
return Tr_Base::insert(p, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -470,7 +470,9 @@ public:
|
|||
//INSERTION
|
||||
|
||||
Vertex_handle insert(const Point & p, Cell_handle start = NULL);
|
||||
|
||||
Vertex_handle insert(const Point & p, Locate_type lt, Cell_handle c,
|
||||
int li, int lj);
|
||||
|
||||
// Obsolete.
|
||||
Vertex_handle push_back(const Point & p)
|
||||
{
|
||||
|
|
@ -2297,6 +2299,14 @@ insert(const Point & p, Cell_handle start)
|
|||
Locate_type lt;
|
||||
int li, lj;
|
||||
Cell_handle c = locate( p, lt, li, lj, start);
|
||||
return insert(p, lt, c, li, lj);
|
||||
}
|
||||
|
||||
template < class GT, class Tds >
|
||||
typename Triangulation_3<GT,Tds>::Vertex_handle
|
||||
Triangulation_3<GT,Tds>::
|
||||
insert(const Point & p, Locate_type lt, Cell_handle c, int li, int lj)
|
||||
{
|
||||
switch (lt) {
|
||||
case VERTEX:
|
||||
return c->vertex(li);
|
||||
|
|
|
|||
|
|
@ -103,18 +103,25 @@ public:
|
|||
Cell_handle locate(const Point& p) const;
|
||||
|
||||
private:
|
||||
|
||||
struct locs {
|
||||
Cell_handle pos;
|
||||
int li, lj;
|
||||
Locate_type lt;
|
||||
};
|
||||
|
||||
void locate(const Point& p, Locate_type& lt, int& li, int& lj,
|
||||
Cell_handle pos[Triangulation_hierarchy_3__maxlevel]) const;
|
||||
locs pos[Triangulation_hierarchy_3__maxlevel]) const;
|
||||
int random_level();
|
||||
|
||||
// added to make the test program of usual triangulations work
|
||||
// undocumented
|
||||
public:
|
||||
|
||||
// FIXME : This one could benefit from the hierarchy too.
|
||||
Vertex_handle insert(const Point& p, Locate_type lt, Cell_handle loc, int li)
|
||||
Vertex_handle insert(const Point& p, Locate_type lt, Cell_handle loc,
|
||||
int li, int lj)
|
||||
{
|
||||
return Tr_Base::insert(p);
|
||||
return Tr_Base::insert(p, lt, loc, li, lj);
|
||||
}
|
||||
|
||||
Vertex_handle insert(const Point &p, Cell_handle start)
|
||||
|
|
@ -266,16 +273,27 @@ insert(const Point &p)
|
|||
Locate_type lt;
|
||||
int i, j;
|
||||
// locate using hierarchy
|
||||
Cell_handle positions[Triangulation_hierarchy_3__maxlevel];
|
||||
locs positions[Triangulation_hierarchy_3__maxlevel];
|
||||
locate(p, lt, i, j, positions);
|
||||
// insert at level 0
|
||||
Vertex_handle vertex = hierarchy[0]->insert(p, positions[0]);
|
||||
Vertex_handle vertex = hierarchy[0]->insert(p,
|
||||
positions[0].lt,
|
||||
positions[0].pos,
|
||||
positions[0].li,
|
||||
positions[0].lj);
|
||||
Vertex_handle previous = vertex;
|
||||
Vertex_handle first = vertex;
|
||||
|
||||
int level = 1;
|
||||
while (level <= vertex_level ){
|
||||
vertex = hierarchy[level]->insert(p, positions[level]);
|
||||
if (positions[level].pos == NULL)
|
||||
vertex = hierarchy[level]->insert(p);
|
||||
else
|
||||
vertex = hierarchy[level]->insert(p,
|
||||
positions[level].lt,
|
||||
positions[level].pos,
|
||||
positions[level].li,
|
||||
positions[level].lj);
|
||||
vertex->set_down((void *) &*previous);// link with level above
|
||||
previous->set_up((void *) &*vertex);
|
||||
previous=vertex;
|
||||
|
|
@ -310,9 +328,9 @@ typename Triangulation_hierarchy_3<Tr>::Cell_handle
|
|||
Triangulation_hierarchy_3<Tr>::
|
||||
locate(const Point& p, Locate_type& lt, int& li, int& lj) const
|
||||
{
|
||||
Cell_handle positions[Triangulation_hierarchy_3__maxlevel];
|
||||
locs positions[Triangulation_hierarchy_3__maxlevel];
|
||||
locate(p, lt, li, lj, positions);
|
||||
return positions[0];
|
||||
return positions[0].pos;
|
||||
}
|
||||
|
||||
template <class Tr>
|
||||
|
|
@ -330,7 +348,7 @@ template <class Tr>
|
|||
void
|
||||
Triangulation_hierarchy_3<Tr>::
|
||||
locate(const Point& p, Locate_type& lt, int& li, int& lj,
|
||||
Cell_handle pos[Triangulation_hierarchy_3__maxlevel]) const
|
||||
locs pos[Triangulation_hierarchy_3__maxlevel]) const
|
||||
{
|
||||
int level = Triangulation_hierarchy_3__maxlevel;
|
||||
|
||||
|
|
@ -342,13 +360,17 @@ locate(const Point& p, Locate_type& lt, int& li, int& lj,
|
|||
}
|
||||
|
||||
for (int i=level+1; i<Triangulation_hierarchy_3__maxlevel; ++i)
|
||||
pos[i]=0;
|
||||
pos[i].pos=0;
|
||||
|
||||
Cell_handle position(NULL);
|
||||
while(level > 0) {
|
||||
// locate at that level from "position"
|
||||
// result is stored in "position" for the next level
|
||||
pos[level] = position = hierarchy[level]->locate(p, position);
|
||||
pos[level].pos = position = hierarchy[level]->locate(p,
|
||||
pos[level].lt,
|
||||
pos[level].li,
|
||||
pos[level].lj,
|
||||
position);
|
||||
// find the nearest vertex.
|
||||
Vertex_handle nearest =
|
||||
hierarchy[level]->nearest_vertex_in_cell(p, position);
|
||||
|
|
@ -358,7 +380,10 @@ locate(const Point& p, Locate_type& lt, int& li, int& lj,
|
|||
position = nearest->cell(); // incident cell
|
||||
--level;
|
||||
}
|
||||
pos[0] = hierarchy[level]->locate(p, lt, li, lj, position); // at level 0
|
||||
pos[0].pos = hierarchy[level]->locate(p, lt, li, lj, position); // at level 0
|
||||
pos[0].lt = lt;
|
||||
pos[0].li = li;
|
||||
pos[0].lj = lj;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue