Problems with remove() for regular triangulation.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems with remove() for regular triangulation.

Frank Dz
typedef CGAL::Regular_triangulation_vertex_base_3<K> Vb0;   // this should
be added.
typedef CGAL::Triangulation_vertex_base_with_info_3<int, K, Vb0> Vb;
typedef CGAL::Regular_triangulation_cell_base_3<K> Cb;
typedef CGAL::Triangulation_data_structure_3<Vb, Cb>                Tds;
typedef CGAL::Regular_triangulation_3<K, Tds> labeled_RT;
typedef labeled_RT::Vertex_handle labeled_rt_Vertex_handle;

...
// then I insert weighted point into the RT.
int index;
map<Weighted_point, labeled_rt_Vertex_handle> map_point_handler;
for (auto p : Point_set) {
                labeled_rt_Vertex_handle vhandle2 = RT.insert(pole);
                vhandle2->info() = index;
                index ++;
                map_point_handler[p] = vhandle2; // I want to map the point to handle
}
labeled_rt_Vertex_handle vhandle22 = map_point_handler[one_p];
quick_test_RT.remove(vhandle22);

=====================================
The enviroment is VS15 on windows machine, release, 64bit.
Then I got this error:
<http://cgal-discuss.949826.n4.nabble.com/file/t376165/error1.jpg>

Exception thrown at 0x00007FF677B167DC in Shape_abstract.exe: 0xC0000005:
Access violation reading location 0x0000000002BF7956.

The vs jumps to:
<http://cgal-discuss.949826.n4.nabble.com/file/t376165/error2.jpg>

I wonder if my usage of 'map' is wrong?

Thanks!






-----
be open, be creative, be critical
--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


be open, be creative, be critical
Reply | Threaded
Open this post in threaded view
|

Re: Problems with remove() for regular triangulation.

Frank Dz
Plus, line 772 is in the file 'Triangulation_data_structure3.h'.


Many thanks for any kind help!


Best,
Frank



-----
be open, be creative, be critical
--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


be open, be creative, be critical
Reply | Threaded
Open this post in threaded view
|

Re: Problems with remove() for regular triangulation.

Frank Dz
In reply to this post by Frank Dz
I also found that

```
                                labeled_rt_Vertex_handle vhandle2 =
quick_test_RT_cpy.insert(p);  
                                vhandle2->info() = myindex;
                                cout <<"inserting: " <<p << endl;
                                cout <<"labeling: " << vhandle2->info() << endl;
                                map_point_handler[p.point()] = vhandle2;
```
if I tried to store the point and the handle in 'map_point_handler'. The
handle is not actually stored only .
Since when I visit the handle again by 'map_point_handler', I can find the
element according to the key: Point, yet the value(handle) is lost.



-----
be open, be creative, be critical
--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


be open, be creative, be critical
Reply | Threaded
Open this post in threaded view
|

Re: Problems with remove() for regular triangulation.

Sebastien Loriot (GeometryFactory)
In reply to this post by Frank Dz
Try to add an assertion with map_point_handler.count(one_p)!=0 to make
sure the key belong to the map + you should remove any element from your
map as soon as a vertex is removed.

Sebastien.

On 2/22/20 2:43 PM, Frank Dz wrote:

> typedef CGAL::Regular_triangulation_vertex_base_3<K> Vb0;   // this should
> be added.
> typedef CGAL::Triangulation_vertex_base_with_info_3<int, K, Vb0> Vb;
> typedef CGAL::Regular_triangulation_cell_base_3<K> Cb;
> typedef CGAL::Triangulation_data_structure_3<Vb, Cb>                Tds;
> typedef CGAL::Regular_triangulation_3<K, Tds> labeled_RT;
> typedef labeled_RT::Vertex_handle labeled_rt_Vertex_handle;
>
> ...
> // then I insert weighted point into the RT.
> int index;
> map<Weighted_point, labeled_rt_Vertex_handle> map_point_handler;
> for (auto p : Point_set) {
> labeled_rt_Vertex_handle vhandle2 = RT.insert(pole);
> vhandle2->info() = index;
>                  index ++;
> map_point_handler[p] = vhandle2; // I want to map the point to handle
> }
> labeled_rt_Vertex_handle vhandle22 = map_point_handler[one_p];
> quick_test_RT.remove(vhandle22);
>
> =====================================
> The enviroment is VS15 on windows machine, release, 64bit.
> Then I got this error:
> <http://cgal-discuss.949826.n4.nabble.com/file/t376165/error1.jpg>
>
> Exception thrown at 0x00007FF677B167DC in Shape_abstract.exe: 0xC0000005:
> Access violation reading location 0x0000000002BF7956.
>
> The vs jumps to:
> <http://cgal-discuss.949826.n4.nabble.com/file/t376165/error2.jpg>
>
> I wonder if my usage of 'map' is wrong?
>
> Thanks!
>
>
>
>
>
>
> -----
> be open, be creative, be critical
> --
> Sent from: http://cgal-discuss.949826.n4.nabble.com/
>

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss