Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2() does not seem to refine the mesh

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

Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2() does not seem to refine the mesh

Gil Hoffer
Hi,

I need to triangulate a set of 2D points (which I calculate - they are very
densed at some areas of the plane, and very sparse in other areas).

My first thought was to use a Delaunay Triangulation to do so.
The problem is that the triangles I get are quite ugly (very sharp angles) - so
I thought that using the mesh refinment functionality of CGAL would do the
trick.

Now - my triangulation is not constrained at any way.
So I've changed my triangulation to a constrained one (In the process I've
extended Delaunay_mesh_face_base_2 to my own subclass called
Delaunay_mesh_face_base_with_info_2 which adds the info field which exists for
a normal Delaunay Triangulation), and tried to run
CGAL::refine_Delaunay_mesh_2() on my Constrained Delaunay Triangulation (with
no constraints added) with the default Category.

Unfortantly - it didn't do anything to the mesh (using different Categories did
not help) - it is still ugly (with very sharp angles).

Any ideas what am I doing wrong?

Thanks,
Gil
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2()

Pierre Alliez
hi Gil,

did you add constraints in the first place so as to bound your domain?

[hidden email] a écrit :

> Hi,
>
> I need to triangulate a set of 2D points (which I calculate - they are very
> densed at some areas of the plane, and very sparse in other areas).
>
> My first thought was to use a Delaunay Triangulation to do so.
> The problem is that the triangles I get are quite ugly (very sharp angles) - so
> I thought that using the mesh refinment functionality of CGAL would do the
> trick.
>
> Now - my triangulation is not constrained at any way.
> So I've changed my triangulation to a constrained one (In the process I've
> extended Delaunay_mesh_face_base_2 to my own subclass called
> Delaunay_mesh_face_base_with_info_2 which adds the info field which exists for
> a normal Delaunay Triangulation), and tried to run
> CGAL::refine_Delaunay_mesh_2() on my Constrained Delaunay Triangulation (with
> no constraints added) with the default Category.
>
> Unfortantly - it didn't do anything to the mesh (using different Categories did
> not help) - it is still ugly (with very sharp angles).
>
> Any ideas what am I doing wrong?
>
> Thanks,
> Gil
>  


--
Pierre Alliez
INRIA Sophia Antipolis - Mediterranee
Project-team GEOMETRICA
http://www-sop.inria.fr/members/Pierre.Alliez/
Tel: +33 4 92 38 76 77
Fax: +33 4 97 15 53 95

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2()

Gil Hoffer
At first I didn't - and the refinement simply did nothing.
When I add constraints to bound my domain (I add the list of edges on the boundary of the domain), the application crashes when I perform the CGAL::refine_Delaunay_mesh_2(adaptiveMesh, Criteria()) with:

First-chance exception at 0x77a542eb in MyApp.exe: Microsoft C++ exception: CGAL::Uncertain_conversion_exception at memory location 0x0757e8b0..
First-chance exception at 0x77a542eb in MyApp.exe: Microsoft C++ exception: std::length_error at memory location 0x0757e8f8..
 
Here's the relevant code snippet which causes the crash:

    std::vector<Point>* quadtreeSeeds = this->calcAdaptiveMeshVerticesUsingQuadTree();
    points.insert(quadtreeSeeds->begin(), quadtreeSeeds->end());

    // in any case - all the points on the cage should be there - make sure
    for (int i=0 ; i< this->cageSize ; ++i) {
        points.insert(Point(this->cage[2*i], this->cage[2*i+1]));
    }

    CDT adaptiveMesh;
    adaptiveMesh.insert(points.begin(), points.end());
    for (int i=0 ; i< this->cageSize ; ++i) {
        Point curr(this->cage[2*i], this->cage[2*i+1]);
        Point next(this->cage[2*((i+1)%cageSize)], this->cage[2*((i+1)%cageSize)+1]);
        adaptiveMesh.insert_constraint(curr,next);
    }

    CGAL::refine_Delaunay_mesh_2(adaptiveMesh, Criteria()); // here it crashes

thanks,

Gil



From: Pierre Alliez <[hidden email]>
To: [hidden email]
Sent: Sunday, January 18, 2009 2:53:55 PM
Subject: Re: [cgal-discuss] Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2()

hi Gil,

did you add constraints in the first place so as to bound your domain?

[hidden email] a écrit :

> Hi,
>
> I need to triangulate a set of 2D points (which I calculate - they are very
> densed at some areas of the plane, and very sparse in other areas).
>
> My first thought was to use a Delaunay Triangulation to do so. The problem is that the triangles I get are quite ugly (very sharp angles) - so
> I thought that using the mesh refinment functionality of CGAL would do the
> trick.
>
> Now - my triangulation is not constrained at any way.
> So I've changed my triangulation to a constrained one (In the process I've
> extended Delaunay_mesh_face_base_2 to my own subclass called
> Delaunay_mesh_face_base_with_info_2 which adds the info field which exists for
> a normal Delaunay Triangulation), and tried to run
> CGAL::refine_Delaunay_mesh_2() on my Constrained Delaunay Triangulation (with
> no constraints added) with the default Category.
>
> Unfortantly - it didn't do anything to the mesh (using different Categories did
> not help) - it is still ugly (with very sharp angles).
>
> Any ideas what am I doing wrong?
>
> Thanks,
> Gil


-- Pierre Alliez
INRIA Sophia Antipolis - Mediterranee Project-team GEOMETRICA http://www-sop.inria.fr/members/Pierre.Alliez/
Tel: +33 4 92 38 76 77
Fax: +33 4 97 15 53 95

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

Reply | Threaded
Open this post in threaded view
|

Re: Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2()

Laurent Rineau (GeometryFactory)
On Sunday 18 January 2009 14:14:09 Gil Hoffer wrote:
> At first I didn't - and the refinement simply did nothing.
> When I add constraints to bound my domain (I add the list of edges on the
> boundary of the domain), the application crashes when I perform the
> CGAL::refine_Delaunay_mesh_2(adaptiveMesh, Criteria()) with:

What is that class Criteria? Why do you think Criteria() is a right value for
criterias?

--
Laurent Rineau, PhD
Engineer at GeometryFactory
http://www.geometryfactory.com/

--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2()

Gil Hoffer
Criteria is: typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Criteria
also when using Criteria(0.125,0.5) (like in the manual), or Criteria(0.125,0) - it still crashes...
It also crashes if I use Criteria as CGAL::Delaunay_mesh_criteria_2<CDT>.
 
Gil



From: Laurent Rineau (GeometryFactory) <[hidden email]>
To: [hidden email]
Sent: Sunday, January 18, 2009 6:15:23 PM
Subject: Re: [cgal-discuss] Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2()

On Sunday 18 January 2009 14:14:09 Gil Hoffer wrote:
> At first I didn't - and the refinement simply did nothing.
> When I add constraints to bound my domain (I add the list of edges on the
> boundary of the domain), the application crashes when I perform the
> CGAL::refine_Delaunay_mesh_2(adaptiveMesh, Criteria()) with:

What is that class Criteria? Why do you think Criteria() is a right value for
criterias?

--
Laurent Rineau, PhD
Engineer at GeometryFactory
http://www.geometryfactory.com/

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

Reply | Threaded
Open this post in threaded view
|

Re: Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2()

Gil Hoffer
OK, it seems like a bug in the combination of CGAL with MS C++ compiler, in release mode, with full optimizations when automatic destruction of C++ exceptions is enabled.
Disabling the automatic destruction + catching the raised CGAL::Uncertain_conversion_exception and ignoring it solved the problem.

It looks like a bug. I don't know if you have an issue tracker (trac?) - but you should open a ticket for it...

thanks for your help,
 
Gil



From: Gil Hoffer <[hidden email]>
To: [hidden email]
Sent: Sunday, January 18, 2009 6:30:50 PM
Subject: Re: [cgal-discuss] Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2()

Criteria is: typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Criteria
also when using Criteria(0.125,0.5) (like in the manual), or Criteria(0.125,0) - it still crashes...
It also crashes if I use Criteria as CGAL::Delaunay_mesh_criteria_2<CDT>.
 
Gil



From: Laurent Rineau (GeometryFactory) <[hidden email]>
To: [hidden email]
Sent: Sunday, January 18, 2009 6:15:23 PM
Subject: Re: [cgal-discuss] Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2()

On Sunday 18 January 2009 14:14:09 Gil Hoffer wrote:
> At first I didn't - and the refinement simply did nothing.
> When I add constraints to bound my domain (I add the list of edges on the
> boundary of the domain), the application crashes when I perform the
> CGAL::refine_Delaunay_mesh_2(adaptiveMesh, Criteria()) with:

What is that class Criteria? Why do you think Criteria() is a right value for
criterias?

--
Laurent Rineau, PhD
Engineer at GeometryFactory
http://www.geometryfactory.com/

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


Reply | Threaded
Open this post in threaded view
|

Re: Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2()

Sylvain Pion
Administrator
Gil Hoffer a écrit :
> OK, it seems like a bug in the combination of CGAL with MS C++ compiler,
> in release mode, with full optimizations when automatic destruction of
> C++ exceptions is enabled.
> Disabling the automatic destruction + catching the raised
> CGAL::Uncertain_conversion_exception and ignoring it solved the problem.

This remdins me of a VC++ bug that we worked around related to bugs in
exception stack unwinding.

Could you please try CGAL-3.4Beta ?
Also, please give more details on your platform (e.g. 32/64 bits).

> It looks like a bug. I don't know if you have an issue tracker (trac?) -
> but you should open a ticket for it...

It would be better if we had a reproducible test-case.

> thanks for your help,
>  
> Gil
>
>
> ------------------------------------------------------------------------
> *From:* Gil Hoffer <[hidden email]>
> *To:* [hidden email]
> *Sent:* Sunday, January 18, 2009 6:30:50 PM
> *Subject:* Re: [cgal-discuss] Refining a 2D Delaunay Triangulation using
> CGAL::refine_Delaunay_mesh_2()
>
> Criteria is: typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Criteria
> also when using Criteria(0.125,0.5) (like in the manual), or
> Criteria(0.125,0) - it still crashes...
> It also crashes if I use Criteria as CGAL::Delaunay_mesh_criteria_2<CDT>.
>  
> Gil
>
>
> ------------------------------------------------------------------------
> *From:* Laurent Rineau (GeometryFactory)
> <[hidden email]>
> *To:* [hidden email]
> *Sent:* Sunday, January 18, 2009 6:15:23 PM
> *Subject:* Re: [cgal-discuss] Refining a 2D Delaunay Triangulation using
> CGAL::refine_Delaunay_mesh_2()
>
> On Sunday 18 January 2009 14:14:09 Gil Hoffer wrote:
>  > At first I didn't - and the refinement simply did nothing.
>  > When I add constraints to bound my domain (I add the list of edges on the
>  > boundary of the domain), the application crashes when I perform the
>  > CGAL::refine_Delaunay_mesh_2(adaptiveMesh, Criteria()) with:
>
> What is that class Criteria? Why do you think Criteria() is a right
> value for
> criterias?
>
> --
> Laurent Rineau, PhD
> Engineer at GeometryFactory
> http://www.geometryfactory.com/
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
>


--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Refining a 2D Delaunay Triangulation using CGAL::refine_Delaunay_mesh_2()

andreas.fabri
In reply to this post by Gil Hoffer
Gil Hoffer wrote:
> OK, it seems like a bug in the combination of CGAL with MS C++ compiler,
> in release mode, with full optimizations when automatic destruction of
> C++ exceptions is enabled.
> Disabling the automatic destruction + catching the raised
> CGAL::Uncertain_conversion_exception and ignoring it solved the problem.

Hi Gil,

I don't understand what you mean with the previous sentence.
As we use exceptions in CGAL, you have to enable exceptions /EHsc
in the project settings.

Best regards,

andreas

>
> It looks like a bug. I don't know if you have an issue tracker (trac?) -
> but you should open a ticket for it...
>
> thanks for your help,
>  
> Gil
>
>
> ------------------------------------------------------------------------
> *From:* Gil Hoffer <[hidden email]>
> *To:* [hidden email]
> *Sent:* Sunday, January 18, 2009 6:30:50 PM
> *Subject:* Re: [cgal-discuss] Refining a 2D Delaunay Triangulation using
> CGAL::refine_Delaunay_mesh_2()
>
> Criteria is: typedef CGAL::Delaunay_mesh_size_criteria_2<CDT> Criteria
> also when using Criteria(0.125,0.5) (like in the manual), or
> Criteria(0.125,0) - it still crashes...
> It also crashes if I use Criteria as CGAL::Delaunay_mesh_criteria_2<CDT>.
>  
> Gil
>
>
> ------------------------------------------------------------------------
> *From:* Laurent Rineau (GeometryFactory)
> <[hidden email]>
> *To:* [hidden email]
> *Sent:* Sunday, January 18, 2009 6:15:23 PM
> *Subject:* Re: [cgal-discuss] Refining a 2D Delaunay Triangulation using
> CGAL::refine_Delaunay_mesh_2()
>
> On Sunday 18 January 2009 14:14:09 Gil Hoffer wrote:
>  > At first I didn't - and the refinement simply did nothing.
>  > When I add constraints to bound my domain (I add the list of edges on the
>  > boundary of the domain), the application crashes when I perform the
>  > CGAL::refine_Delaunay_mesh_2(adaptiveMesh, Criteria()) with:
>
> What is that class Criteria? Why do you think Criteria() is a right
> value for
> criterias?
>
> --
> Laurent Rineau, PhD
> Engineer at GeometryFactory
> http://www.geometryfactory.com/
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
>

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