Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Imhotep), 567 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ear clipping triangulation of simple polygons #464687
03/06/17 10:13
03/06/17 10:13
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline OP
Serious User
txesmi  Offline OP
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi!
A simple polygon has no shared vertex, crossing edges or holes and it is sorted counter-clockwise on right handed coordinates. The algorithm takes three contiguos points, checks the angle between segments and checks if any other point is not contained by the triangle in order to set it as a valid triangle. This method is far from been the fastest but it is pretty easy to follow.


DOWNLOAD
Draw a polygon by mouse left button and triangulate it by mouse right button. You can watch the process by uncommenting SHOW_BUILT definition on 'simple_polygon.h'

Enjoy!

Re: ear clipping triangulation of simple polygons [Re: txesmi] #464689
03/06/17 10:27
03/06/17 10:27
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Very interesting, thanks for sharing!


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: ear clipping triangulation of simple polygons [Re: Superku] #464696
03/06/17 12:17
03/06/17 12:17
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
cool stuff. can be pretty helpful when filling shapes... I might even need this laugh


POTATO-MAN saves the day! - Random
Re: ear clipping triangulation of simple polygons [Re: Kartoffel] #464698
03/06/17 13:17
03/06/17 13:17
Joined: Feb 2003
Posts: 146
RP China
2
20BN Offline
Member
20BN  Offline
Member
2

Joined: Feb 2003
Posts: 146
RP China
thanks for sharing!

it's very useful for pathfinding!!!!!!!!!

Re: ear clipping triangulation of simple polygons [Re: 20BN] #464713
03/07/17 05:27
03/07/17 05:27
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline OP
Serious User
txesmi  Offline OP
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
glad of been helpfull wink

Re: ear clipping triangulation of simple polygons [Re: txesmi] #464921
03/16/17 23:31
03/16/17 23:31
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
Cool, how difficult would it be to extend it to handle holes?

Re: ear clipping triangulation of simple polygons [Re: PadMalcom] #464941
03/18/17 07:20
03/18/17 07:20
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline OP
Serious User
txesmi  Offline OP
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Originally Posted By: PadMalcom
Cool, how difficult would it be to extend it to handle holes?
As far as I read it is not hard to achieve. It is planned wink

Re: ear clipping triangulation of simple polygons [Re: txesmi] #464943
03/18/17 14:08
03/18/17 14:08
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Another useful feature would be selecting clockwise/counter-clockwise triangle creation automatically. This should work by adding the relative angles between all lines (of the outline) and checking if the result is greater or less than 0. (theoretically only +360° or -360° are possible).


POTATO-MAN saves the day! - Random
Re: ear clipping triangulation of simple polygons [Re: Kartoffel] #472916
05/29/18 15:46
05/29/18 15:46
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
txesmi@ man, you are awesome, just as always! thank you very much for this contribution!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: ear clipping triangulation of simple polygons [Re: 3run] #472925
05/30/18 08:41
05/30/18 08:41
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline OP
Serious User
txesmi  Offline OP
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
thanks laugh enjoy!


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1