bjorkegeek / polytri Goto Github PK
View Code? Open in Web Editor NEWPython 3 polygon triangulation algorithm
License: MIT License
Python 3 polygon triangulation algorithm
License: MIT License
(As reported in an email from Charles Bradshaw)
I have been using your python polygon triangulate algorithm successfully for some time.
Mostly it works well, but if I present this polygon:
[ 1.0000, -0.5000, 1.0000]
[ 0.7500, -0.4330, 1.0000]
[ 0.5670, -0.2500, 1.0000]
[ 0.5000, 0.0000, 1.0000]
[ 0.5670, 0.2500, 1.0000]
[ 0.7500, 0.4330, 1.0000]
[ 1.0000, 0.5000, 1.0000]
[ 1.0000, 1.0000, 1.0000]
[-1.0000, 1.0000, 1.0000]
[-1.0000, -1.0000, 1.0000]
[ 1.0000, -1.0000, 1.0000]
I see the ValueError("Triangulation dot < 1E-20") , as the value of dot is zero. (I changed the value to 1E-20 to get a previous example to work)
I can make triangulate work by rotating the vertices so as to present some other point first. For example this:
[ 0.5000, 0.0000, 1.0000]
[ 0.5670, 0.2500, 1.0000]
[ 0.7500, 0.4330, 1.0000]
[ 1.0000, 0.5000, 1.0000]
[ 1.0000, 1.0000, 1.0000]
[-1.0000, 1.0000, 1.0000]
[-1.0000, -1.0000, 1.0000]
[ 1.0000, -1.0000, 1.0000]
[ 1.0000, -0.5000, 1.0000]
[ 0.7500, -0.4330, 1.0000]
[ 0.5670, -0.2500, 1.0000]
Produces a result. However it is wrong. Please see the attached showing the result of the latter data set. In the image the yellow lines and green points is the above polygon. The blue arrows show the winding order. The white lines are the triangles returned for your code. Some falling outside the original polygon!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.