[postgis-devel] new constrained delauney triangulation

Nicklas Avén nicklas.aven at jordogskog.no
Wed Mar 13 15:25:56 PDT 2019


On 3/11/19 8:44 PM, Nicklas Avén wrote:
>
>
> On 3/11/19 8:29 PM, Martin Davis wrote:
>> This looks impressive.
>>
>> I was going to suggest if all that was really needed was polygon 
>> triangulation then perhaps ear-clipping would be faster.  But if this 
>> is already faster...
>>
>> And yes, ear-clipping can produce very ugly triangulations.  For an 
>> approach to solving that see my blog post from a long time back: 
>> http://lin-ear-th-inking.blogspot.com/2011/04/polygon-triangulation-via-ear-clipping.html
>>
>> The risk of crashing hard is a bit of a worry though. Any idea if 
>> that can be fixed?
>
>
> Yes it should be possible to prevent. Most cases is just me haven't 
> added proper handling.
>
> But the most annoying case is when searching the triangles I do it 
> through the edges who have the triangles on both sides registered.
>
> If there is a bug making the search just switch back and forth between 
> two triangles it seems unstoppable. Maybe there is some magic code to 
> put there, but I have had occations when kill pid haven't stopped it.
>
> So I have had to kill the machine or the VM (I am on Qubes so it is 
> easy in my case).
>

I have committed something that I think takes control over those 
unpredicted situations.

I have added a counter on the places where I have identified that those 
infinite loops possibly can occur.

Normally those iterations shouldn't be more than a few loops (or 
recursions).

So I check if they are more than the number of inputed points. If so, it 
error handles.

That should catch any possible situation that we cannot think of I guess.

I have also added some error handling, in general so now it is not 
supposed to crash the server.

There are most probably more situations that should be handled, but at 
least it should not get into infinite loop state I hope.

I have also added some commenting, but it is not complete.

/Nicklas



More information about the postgis-devel mailing list