Inserting constraints in Constrained_triangulation_plus_2

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

Inserting constraints in Constrained_triangulation_plus_2

marin
Hello,

I have two questions about inserting constraints in
Constrained_triangulation_plus_2 triangulation.

I'm using triangulation defined like this
        typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
        typedef CGAL::Projection_traits_xy_3<K> Gt;
        typedef CGAL::Triangulation_vertex_base_with_info_2<FaceInfo2, Gt> Vbb;
        typedef CGAL::Triangulation_hierarchy_vertex_base_2<Vbb> Vb;
        typedef CGAL::Constrained_triangulation_face_base_2<Gt> Fb_base;
        typedef CGAL::Triangulation_face_base_with_info_2<FaceInfo2, Gt, Fb_base>
Fb;
        typedef CGAL::Triangulation_data_structure_2<Vb, Fb> TDS;
        typedef CGAL::Exact_predicates_tag Itag;
        typedef CGAL::Constrained_Delaunay_triangulation_2<Gt, TDS, Itag>
Delaunay_base;
        typedef CGAL::Triangulation_hierarchy_2<Delaunay_base> Triangulation;
        typedef CGAL::Constrained_triangulation_plus_2<Triangulation> Delaunay;

1. insert_constraint sometimes throws an exception
        I am using function Constraint_id CGAL::Constrained_triangulation_plus_2<
Tr >::insert_constraint( PointIterator first, PointIterator last, bool close
= false )
       
        - it throws exception every time if I try to insert the same polyline
twice.
        - sometimes it throws exception inserting not already inserted constraints.
       
        Since Constrained_triangulation_plus_2 should support any polylines layout
as constraints including those intersecting each other, please I'm wondering
what are preconditions for the Insert_constraint function in order to work
without exception?

2. In reference manual I've found the function Insert_constraints (plural)
that allows inserting many polyline constraints at once using optimized
algorithm with spatial indexes but I haven't found any examples how to use
it. Please if there are some examples available I would be very grateful.
insert_constraints ( ConstraintIterator first, ConstraintIterator last )

Thank you very much for answers.

Best regards,
Marin



--
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


Reply | Threaded
Open this post in threaded view
|

Re: Inserting constraints in Constrained_triangulation_plus_2

Sebastien Loriot (GeometryFactory)
Please provide a small self-contained example showing the pb.
I just gave a try with inserting already inserted constraints
and it worked without issues with the Exact_predicates_tag tag.
Are you sure you are always using this tag?

Sebastien.

On 11/07/2018 10:39 AM, marin wrote:

> Hello,
>
> I have two questions about inserting constraints in
> Constrained_triangulation_plus_2 triangulation.
>
> I'm using triangulation defined like this
> typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
> typedef CGAL::Projection_traits_xy_3<K> Gt;
> typedef CGAL::Triangulation_vertex_base_with_info_2<FaceInfo2, Gt> Vbb;
> typedef CGAL::Triangulation_hierarchy_vertex_base_2<Vbb> Vb;
> typedef CGAL::Constrained_triangulation_face_base_2<Gt> Fb_base;
> typedef CGAL::Triangulation_face_base_with_info_2<FaceInfo2, Gt, Fb_base>
> Fb;
> typedef CGAL::Triangulation_data_structure_2<Vb, Fb> TDS;
> typedef CGAL::Exact_predicates_tag Itag;
> typedef CGAL::Constrained_Delaunay_triangulation_2<Gt, TDS, Itag>
> Delaunay_base;
> typedef CGAL::Triangulation_hierarchy_2<Delaunay_base> Triangulation;
> typedef CGAL::Constrained_triangulation_plus_2<Triangulation> Delaunay;
>
> 1. insert_constraint sometimes throws an exception
> I am using function Constraint_id CGAL::Constrained_triangulation_plus_2<
> Tr >::insert_constraint( PointIterator first, PointIterator last, bool close
> = false )
>
> - it throws exception every time if I try to insert the same polyline
> twice.
> - sometimes it throws exception inserting not already inserted constraints.
>
> Since Constrained_triangulation_plus_2 should support any polylines layout
> as constraints including those intersecting each other, please I'm wondering
> what are preconditions for the Insert_constraint function in order to work
> without exception?
>
> 2. In reference manual I've found the function Insert_constraints (plural)
> that allows inserting many polyline constraints at once using optimized
> algorithm with spatial indexes but I haven't found any examples how to use
> it. Please if there are some examples available I would be very grateful.
> insert_constraints ( ConstraintIterator first, ConstraintIterator last )
>
> Thank you very much for answers.
>
> Best regards,
> Marin
>
>
>
> --
> 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


Reply | Threaded
Open this post in threaded view
|

Re: Inserting constraints in Constrained_triangulation_plus_2

marin
This post was updated on .
Thank you for quick replay Sebastien.

Strange. I can reproduce it every time. Have you used exactly the same
templates as I am? Also triangulation points and constraints are 3D points.
Could it be the issue if I'm inserting constraint aligned with vertices and
edges?

Yes I'm using Exact_predicates_tag itag.

I will make example but I thought that maybe my problem is trivial so wanted
to check first. I will need a little time to create example.

maybe you could get a clue from where the cgal exception occurs. First is exact place and next image is few steps before in a call stack.




Thank you,
Marin



--
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


Reply | Threaded
Open this post in threaded view
|

Re: Inserting constraints in Constrained_triangulation_plus_2

Sebastien Loriot (GeometryFactory)
On 11/07/2018 01:03 PM, marin wrote:
>
> Thank you for quick replay Sebastien.
>
> Strange. I can reproduce it every time. Have you used exactly the same > templates as I am? Also triangulation points and constraints are 3D
points.

I used the same types but for the traits but it shouldn't be an issue.

Sebastien.

> Could it be the issue if I'm inserting constraint aligned with vertices and
> edges? >
> Yes I'm using Exact_predicates_tag itag.
>
> I will make example but I thought that maybe my problem is trivial so wanted
> to check first. I will need a little time to create example.
>
> Thank you,
> Marin
>
>
>
> --
> 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


Reply | Threaded
Open this post in threaded view
|

Re: Inserting constraints in Constrained_triangulation_plus_2

marin
This post was updated on .
Hello,

I've made sample that shows exception I get.

Here is full Visual studio solution along with example.xyz points file.
cgal_constraints.7z
<http://cgal-discuss.949826.n4.nabble.com/file/t376044/cgal_constraints.7z

This is main function:
        Delaunay dt;

        //load points
        std::ifstream in("example.xyz");
        std::istream_iterator<Point_3> begin(in), end;
        dt.insert(begin, end);

        //poly constraint
        std::vector<Point_3> vec_constraint;
        vec_constraint.push_back(Point_3(5473710.1302, 5016278.5325, 765.));
        vec_constraint.push_back(Point_3(5473690.8656, 5016268.1857, 765.));
        vec_constraint.push_back(Point_3(5473678.2141, 5016247.2048, 765.));
        vec_constraint.push_back(Point_3(5473647.1607, 5016221.9126, 765.));
        vec_constraint.push_back(Point_3(5473638.2472, 5016199.2072, 765.));

        Constraint_id cid = dt.insert_constraint(vec_constraint.begin(), vec_constraint.end());

        //I'm getting exception on this command
        cid = dt.insert_constraint(vec_constraint.begin(), vec_constraint.end());


When calling dt.insert_constraint second time I'm getting exception in CGAL.

Thank you very much!
Marin




--
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


Reply | Threaded
Open this post in threaded view
|

Re: Inserting constraints in Constrained_triangulation_plus_2

Sebastien Loriot (GeometryFactory)
Hi,

I can reproduce the issue.
I opened a ticket here:
https://github.com/CGAL/cgal/issues/3447

It has to do with the insertion of polylines in a CDT+.

We will update the issue when the bug is fixed.

Thanks for the report,

Sebastien.

On 11/08/2018 02:21 PM, marin wrote:

> Hello,
>
> I've made sample that shows exception I get.
>
> Here is full Visual studio solution along with example.xyz points file.
> cgal_constraints.7z
> <http://cgal-discuss.949826.n4.nabble.com/file/t376044/cgal_constraints.7z>
>
> This is main function:
>
>
> When calling dt.insert_constraint second time I'm getting exception in CGAL.
>
> Thank you very much!
> Marin
>
>
>
>
> --
> 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


Reply | Threaded
Open this post in threaded view
|

Re: Inserting constraints in Constrained_triangulation_plus_2

marin
Hi,

You're welcome.

Many thanks. I will follow the ticket.

Regards,
Marin



--
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


Reply | Threaded
Open this post in threaded view
|

Re: Inserting constraints in Constrained_triangulation_plus_2

marin
Hi to all!

I don't see any progress on GitHub ticket #3477 about this issue.

Except temporary solution has been removed from 4.12.2 milestone.

What is plan for this issue? Will it be fixed in near future?

Regards,
Marin

  



On Fri, Nov 9, 2018 at 9:11 AM marin <[hidden email]> wrote:
Hi,

You're welcome.

Many thanks. I will follow the ticket.

Regards,
Marin



--
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


Reply | Threaded
Open this post in threaded view
|

Re: Inserting constraints in Constrained_triangulation_plus_2

marin
In reply to this post by Sebastien Loriot (GeometryFactory)
Hi,

I don't see any progress on GitHub ticket #3477 about this issue.

Except temporary solution has been removed from 4.12.2 milestone.

Do you have some insights what is plan for this issue? Will it be fixed in near future?

Essentially I need to be able to add intersecting constraints and write custom data into faces and vertices. Do you think it is better to go with some other package? Is this Constrained_triangulation_plus_2  package under development and too early to be stable?

Regards,
Marin

On Fri, Nov 9, 2018 at 7:22 AM Sebastien Loriot (GeometryFactory) <[hidden email]> wrote:
Hi,

I can reproduce the issue.
I opened a ticket here:
https://github.com/CGAL/cgal/issues/3447

It has to do with the insertion of polylines in a CDT+.

We will update the issue when the bug is fixed.

Thanks for the report,

Sebastien.

On 11/08/2018 02:21 PM, marin wrote:
> Hello,
>
> I've made sample that shows exception I get.
>
> Here is full Visual studio solution along with example.xyz points file.
> cgal_constraints.7z
> <http://cgal-discuss.949826.n4.nabble.com/file/t376044/cgal_constraints.7z>
>
> This is main function:
>
>
> When calling dt.insert_constraint second time I'm getting exception in CGAL.
>
> Thank you very much!
> Marin
>
>
>
>
> --
> 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