In the process of drawing with OpenGL, since OpenGL does not support direct drawing of concave polygon, we usually need to first convert the concave polygon into a group of triangles with a triangular Polygon Algorithm
1) use a one-way cyclic linked list to save the polygon vertices and calculate the convex and concave of each vertex in the linked list.
2) in the cyclic linked list, take the three nodes P, Q, and r sequentially. If Q is a convex point, if the triangle pqr composed of P, Q, and R does not contain other vertices on the polygon, the feature angle of △pqr is calculated (the smallest angle in the triangle ). Find all these triangles, select the largest △pqr from the feature angle, save the triangle, and delete node Q from the linked list.
3) If there are no more than three vertices in the linked list, go to step 2 ).
4) A triangle is formed by the last three vertices in the linked list.
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