Comments (16)
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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)
- Java source unbuildable in 1.7+
- Build failed when compliling with -we4715
- Java findbugs - nullcheck of value previously dereferenced HOT 1
- [java] Tessellation with hole error HOT 4
- Polygon with hole HOT 10
- [java] Missing triangle in non-constrained delaunay HOT 3
- Problem building library
- the EPSILON value is not exported in the python/cython version HOT 1
- Odd crash on sanitized input (c++) HOT 8
- CMake build script
- Inconsistent behavior with holes that share a point HOT 17
- add typedef for "double"
- add typedef for std::vector<Point*>, std::vector<Triangle*> and other containers
- Triangulate crashes in sweep.cc:703 HOT 3
- java version compile error HOT 3
- Polygon.getHoles() missing HOT 5
- poly2tri crashes on a very simple geometry HOT 1
- crash with attached polygon HOT 2
- Crash when triangulating a polygon HOT 1
- crash with square polygon HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poly2tri.