Data about the polygon triangle Embedding Algorithm

Source: Internet
Author: User
Tags traits
I checked the information carefully. Some people have summarized the division of polygon through the Internet.

Although OpenGL glutesselation is easy to use, it is said that the algorithm is not efficient.

The better algorithm is the ploy2tri algorithm. Try again if you have time.

Triangulation of simple polygons
Ben discoe, notes from 2001.02.11, updated through 2009.01

I needed some code for tessellating polygons, which cocould be integrated into the VTP libraries, with the following desirable traits:

  • Portable
  • No dependencies on large external Libraries
  • Free (no restrictive License)
  • In C/C ++
  • Easy to use
  • Preferably, handles 'holes 'in the Polygon

Here are each of the options I found.

  1. OpenGL

    • Contains functionality (in the Glu Library) which is capable of tessellation
    • Problem: requires a complicated system of registering 6 callback Functions
    • Problem: Not easy to use, no example code in Red Book
    • Problem: has large external dependency (OpenGL, with a valid context)
    • Extracting the glutessellate functionality from the SGI OpenGL sample implementation
      • One developer has done this, and says "It was very easy "(!) Which seems rather surprising
    • Val é ry Moya wrote in July 2009:
      • "I wrote my own Glu tesselator. grabbing the tessellation from the callbacks isn't all that hard and doesn't require too much code to get working. (In fact, I got it working with just 2 of the callbacks registered: glu_tess_begin and glu_tess_vertex .) in my trial, I was able to get tessellations from lists Verts that make up the contour of the polygon I Wanted To Tessellate (with no overlapping edged, but allowing holes defined as counterclockwise list of verts ). the "hard" part is that you need to handle getting the triangulated Verts as triangles, triangle fans and triangle strip order but this not as bad as it sounds to keep track."
      • Val's code: glu_tesselation.c
  2. Fast polygon triangulation based on Seidel's Algorithm(1995)
    • Has C code available
    • Problem: Small UNIX dependency (<sys/time. h>), callnonstandard stdlib function "log2"
    • Problem: In the function add_segment (), a variable is used without being initialized-I. e. It's questionable code
    • Problem? The readme written in 1995 says "for non-essential cial use only"
      • The author Atul narkhede, who went from CMU to SGI, refers to the code on a more current website as specifically "public domain", so the latest status is apparently non-restrictive
    • 2008, received an email from another guy trying the code, and he found the code was too buggy
  3. Efficient polygon triangulation, By John W. Ratcliff on flipcode
    • C ++ code, very small and easy to use!
    • Uses STL, but this dependency was easy to remove
    • Tested it on my own data, it worked very well. Add it to vtdata.
    • Only one problem: doesn't handle holes (and doesn't claim)
  4. GPC
    • Does clipping and Boolean operations in addition to triangulation
    • Problem: reportedly "uses a simple trapezoidal decomposition that introduces lots of T-junctions"
    • Problem: prohibitive license Restricts usage
  5. "Triangle"By Jonathan shewchuk
    • Can produce Dirichlet triangulations, which apparently have desirable traits for some purposes, but are a bit overkill for the general case. for our simpler case it can produce "constrained Dirichlet", which means no extraneous triangles.
    • Supports holes!
    • Source is free and portable, only one source file (triangle. c) which makes it easy to integrate.
    • One small drawback: You can't just tell it which segments are the edges of your hole. instead, you must supply some point that lies within the hole. triangle triangulate the hole, then does some kind of "Flood fill" to empty it. it's inefficient, but what's worse is it requires the caller to compute a point-in-polygon for the hole. this is a non-trivial Algorithm for an arbitrary complex polygon.
    • In 2008.01, I adapted the triangle code with a wrapper to call it from vtlib. it works quite well, for a very large number of polygons. however, there are some (rare) cases of degenerate geometry where it will crash. in particle, it does not like duplicate vertices or duplicate edges. 'duplicate' in this case is relative to numeric precision: for a building 10-100 meters in size, two vertices within 8 cm of each other, defining a very short edge, can cause triangle to crash.
  6. Terragear
    • A free library which contains a cleaned-up version of the narkhede implementation of the Seidel algorithm (above )? No. Perhaps it did back in 2001, but as of 2007, it contains code to call "Triangle". It is actually useful as good example code of how to call triangle.
  7. Panda3d
    • A huge, Free Software Stack used by Disney's VR Group, which has des triangulation adapted from "narkhede A. And manocha D., fast polygon triangulation algorithm based on Seidel's algorithm"
    • The triangulation is buried deep in the C ++ part of its code, underneath a massive mess of Python, TCL, cross-platform complete action, and custom build tools used to build custom build tools!
    • On 2008.01.30, I lifted the 'trigger' module out of panda, made it standalone, and ran the provided test (test_tri.cxx). It crashed, with a negative array index.
    • I also spent 3 hours trying to build panda itself (with most dependencies including Python disabled.) No luck, it is just too complex.
    • There are some implications on this panda3d Forum Thread that the panda version of narkhede-manocha might be cleaned up or fixed. however, since it crashes (for me) on a simple test outside of panda, This is not encouraging.
    • From: Sébastien Berthet [mailto:sbrt@yahoo.fr]
      Sent: Friday, February 01, 2008 12:56 AM
      I assume that you used the last version on CVS (commited 3 weeks ago), right ?  http://panda3d.cvs.sourceforge.net/panda3d/panda/src/mathutil/triangulator.cxx?revision=1.5&view=markup
      The thread on the forum mentions a few fixes...
  8. Poly2tri(Liang/Kittelman)
    • "Subdivision using monotone polygons and a sweep line algorithm, O (n log n) time and O (n) Storage"
    • Supports holes, make a lot of very skinny triangles
    • Wu Liang's page is offline as of 2008, but can be found via Wayback Machine: Wu poly2tri. it compares the speed of poly2tri. extends other triangulation algorithms/implementations, And it is faster, although the triangles produced are very skinny slivers
    • The latest open source available at polygontriangulator. cxx, by Thomas Kittelmann, adapted from an implementation by Wu Liang (2005), which appears to be part of a project called "Atlas lxr"
    • There is also a page on poly2tri by Ariel Bernal, which has no source available, and it's not clear if its simply a compilation of the Liang/Kittelman code
Others
  • Triangulating a simple polygon in linear time (chazelle 1991)
  • M. Held (2001): "Fist: Fast industrial-strength triangulation of polygons". Fist is not open source nor allows unrestricted use.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.