Comments (12)
Any chance you could dump the polygon data in a file of the form
x,y
x,y
.
.
x,y
then add it as an attachment to this thread so I could run a test triangulation
on the failing points.
Original comment by [email protected]
on 28 Dec 2011 at 4:26
from poly2tri.
[deleted comment]
from poly2tri.
Can't help you without some polygon data. But if you have a crash when the
contours touch the border I guess you get multiple points that are located on a
straight line.
I am aware of an issue when multiple points is collinear to a line. The
triangulation might fail in some rare cases and I'm working on solving that.
Don't know it this has anything to do with your problem.
You could try to just add a tiny random x,y offset to points that are on the
"border" and see if that help. The offset could be very tiny so it not even
visible.
Original comment by [email protected]
on 5 Jan 2012 at 11:10
from poly2tri.
Thanks a lot for your answer.
In fact I implemented the library in a Quartz Composer plugin, so it's hard to
obtain the coordinates list before it crashes.
I'll try your "tiny random" way and tell you.
Original comment by [email protected]
on 6 Jan 2012 at 1:23
from poly2tri.
I can try to output the reqquested list to the console so I can send you a file.
Original comment by [email protected]
on 6 Jan 2012 at 1:25
from poly2tri.
Hi, and thank you for your patience.
Here are finally two diferent file output by my Quartz Composer plugin before
it crashes (don't know exactly if this is before or while it is crashing, but
I'm writing to the file before passing the coordinates to the poly2tri
routine).
Thanks a lot for your help !
Original comment by [email protected]
on 10 Jan 2012 at 5:03
Attachments:
from poly2tri.
I found the error in both files.
The thing is that poly2tri require the input to only have one point on a
specific coordinate. If we are talking polygons this means that the polygon
can't touch itself.
So your polygon needs to be a simple polygon, eg. no intersecting or touching
edges/points.
01 contains these duplicates points: [139.000000,20.000000]
02 contains these duplicates points: [251.000000,51.000000]
Maybe you can alter your algorithm a bit so polygons with touching points
aren't generated.
One thing that we really should have added in a readme is that the lib prefers
points to be in the range -1,1 for best precision handling. But I don't think
you will run into that problem with your points.
Original comment by [email protected]
on 11 Jan 2012 at 12:24
from poly2tri.
Thanks !
I'm sure my ploygons are not self-intersecting, but perhaps OpenCV might
duplicate point on found contours ?
I'm a bit afraid about comparing each point to the other points of the same
polygon, for the performance. Do you have any advice ?
Original comment by [email protected]
on 11 Jan 2012 at 9:37
from poly2tri.
I'm sorry : I checked the OpenCV doc and it might produce self-intersecting
contours...
Original comment by [email protected]
on 11 Jan 2012 at 9:46
from poly2tri.
Sorry for flooding... I implemented this code to make it treat my OpenCV
contours result and it is working very well :
http://www.gamedev.net/topic/548477-fast-2d-polygon-self-intersect-test/
Thanks again
Original comment by [email protected]
on 11 Jan 2012 at 11:48
from poly2tri.
Great that you could find a solution :).
At some point I want poly2tri to support self-touching polygons, e.g. polygons
with holes that touch the outer contour. Hopefully this will happen sooner than
later.
Original comment by [email protected]
on 11 Jan 2012 at 12:03
- Changed state: WontFix
from poly2tri.
Another simple and fast solution : set the contour flag in OpenCV to
CV_RETR_EXTERNAL instead of CV_RETR_TREE. That was the problem ! I was not
treating holes (that I can get from RETR_TREE) na dpassing them as polygons...
Your lib is very fast and useful. Thanks a lot !
Original comment by [email protected]
on 11 Jan 2012 at 12:38
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.