Code Monkey home page Code Monkey logo

Comments (16)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Falls in SweepContext::MeshClean() calling itself a lot of times.

If this gets fixed soon, I may test this more massively. Up to 1M of points for 
performance and also with data generating floating-point round-off errors like 
commented in code above.

Original comment by [email protected] on 16 Nov 2011 at 2:25

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
just took a quick glance at the code.

When adding steiner points they must be inside the rectangle polygon.
Since you use the point set to find max an min x,y values there should be a 
chance that one of the points in the set will be on the edge of the rectangle 
you create, maybe this is your problem.

The triangulation algorithm assume that given polygon isn't self intersecting 
or touching and that steiner point are inside the polygon and not on the edge 
or outside.

Original comment by [email protected] on 16 Nov 2011 at 9:12

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Well.. not only a chance, atleast 2 points would be on the corner or edge of 
the rectangle. Try growing the rectangle a tiny bit and see if it works better.

Original comment by [email protected] on 16 Nov 2011 at 9:25

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Did this suggestion solve your problem? Want to know if I can close this issue 
:)

Original comment by [email protected] on 19 Nov 2011 at 7:43

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Adding these lines after min-max finding:
  minx -= 100;
  miny -= 100;
  maxx += 100;
  maxy += 100;

Didn't solve the problem - I note that values generated are from 0 to approx. 
32K so adding 100 to boundary should be more than enough.

Original comment by [email protected] on 21 Nov 2011 at 8:23

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Ah I think I know the issue. 

The MeshClean algorithm is recursive. It traverse the triangle graph 
recursively in a polygon until it finds an edge. Since we only got a rectangle 
with 4 edges and a massive amount of internal triangles the recursive depth can 
get really big.

I know someone rewrote MeshClean to be nonrecursive: see bottom of this issue

http://code.google.com/p/poly2tri/issues/detail?id=12&can=1

this is not the c++ version but I guess you could just port it. I agree that 
current MeshClean is a weakness and probably should be rewritten.

Original comment by [email protected] on 21 Nov 2011 at 1:36

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Well I think you should really fix that in c++ version. I have switched to use 
q-hull library for delaunay triangulation as even when you fix the issue, I'm 
not quite sure that your algorithm is really stable.

Original comment by [email protected] on 21 Nov 2011 at 4:36

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Well this lib is excellent for triangulating polygons with valid input. eg. no 
duplicate points, touching or intersecting edges. For that I'd say it is really 
stable. Thats what it was written for originally.

qhull is a nice lib, so unless you need constrained triangulation it is 
probably a better solution.

Original comment by [email protected] on 21 Nov 2011 at 5:27

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Well yes, the qhull is really working, but the interface is terrible. Our 
company would however also use stable constrained triangulation (surface 
remeshing, etc...). But my point is that anyone who downloads the code will 
test it like I did and stack overflow errors on first run isn't probably the 
image of library you would like to have.

Original comment by [email protected] on 22 Nov 2011 at 12:18

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
The c++ version is a simplified port of the java version I wrote. The java 
version separates polygon and pointset triangulations and have different 
MeshClean functions so this problem never arise. 

I have notified mason and hopefully he can implement a non recursive mesh clean 
for the c++ version. I think most have used this lib as a polygon tesselator 
and not used that many steiner points.


Original comment by [email protected] on 22 Nov 2011 at 4:46

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
I can fix this, although I need to make the time. This is a hobby project for 
me, not used professionally, and I have too many other side interests I'm 
pursing at the moment. 

I have a week off from work over the holidays, and will commit several hours to 
finding a good solution.

Original comment by [email protected] on 14 Dec 2011 at 2:56

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
With 10000 random points, you may have some duplicate points. You need to 
provide poly2tri with a valid input set to work correctly, and all the points 
should be contained within your constrained edges.

I will add a non-recursive version of MeshClean for good measure.

Original comment by [email protected] on 4 Feb 2012 at 8:41

  • Changed state: Invalid

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Well my code is obviously removing the duplicated points so that's not the 
problem.

Original comment by [email protected] on 5 Feb 2012 at 5:07

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
I have the same problem: With around 20000 Steiner points (the limit varies), I 
get a stack overflow in SweepContext::MeshClean. I make sure that there are no 
duplicate points.

Could you please provide the promised non-recursive version of MeshClean? Would 
help me a lot.

Original comment by [email protected] on 25 Jun 2012 at 11:26

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Well I worked out a replacement for MeshClean, using a std::stack instead of 
the "real" stack. I tested it with 300,000 Steiner points, it worked. For 
10,000 Steiner points, the destruction of the CDT object takes exactly the same 
time with your and my version (both 750 msec). Your testbed also runs without 
errors.

I wonder if this could be implemented more efficiently - destruction of a CDT 
object with 300,000 Steiner points takes as long as 38 sec (but at least there 
is no overflow :) ).

Attached you'll find the code.
* added  #include <stack>
* new version of SweepContext::MeshClean
* (no other changes)

Original comment by [email protected] on 25 Jun 2012 at 12:40

Attachments:

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Well instead of calling destructor allocate on custom memory managed heap and 
throw the memory in heap away (without calling destructors).

Original comment by [email protected] on 1 Jul 2012 at 5:47

from poly2tri.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.