GithubHelp home page GithubHelp logo

Comments (12)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
[deleted comment]

from poly2tri.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 9, 2024
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)

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.