Triangulation as a triangle strip

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
darkfrei
Party member
Posts: 419
Joined: Sat Feb 08, 2020 11:09 pm

Triangulation as a triangle strip

Post by darkfrei »

Hi all!

Is here an easy way to do the triangle strip from polygon?


In this way you can store all polygons just like one Löve's "line". Such as triangles:
1-2-3, 2-3-4, 3-4-5, 4-5-6, 5-6-7 etc.

The standard polygon triangulation, what I have and what I've expected:
Attachments
2021-08-14T15_08_20-01.png
2021-08-14T15_08_20-01.png (22.83 KiB) Viewed 3893 times
2021-08-14T15_14_27-02.png
2021-08-14T15_14_27-02.png (26.93 KiB) Viewed 3893 times
:awesome: Falling in LÖVE :awesome:
I Löve Lua and Love2D
User avatar
ivan
Party member
Posts: 1736
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Triangulation as a triangle strip

Post by ivan »

darkfrei wrote: Sat Aug 14, 2021 8:45 pm Hi all!
Hello!
darkfrei wrote: Sat Aug 14, 2021 8:45 pm Is here an easy way to do the triangle strip from polygon?
Not sure, but my gut feeling is that no, there is no easy way to do it from ANY polygon.
I don't think it's even possible to create a triangle strip for ANY concave polygon either.
It could be done with relatively easy math if you have a "path" or a "polyline" (if you planning to do something like a "stroke" function).
Last edited by ivan on Tue Aug 17, 2021 5:26 am, edited 1 time in total.
User avatar
pgimeno
Party member
Posts: 2829
Joined: Sun Oct 18, 2015 2:58 pm

Re: Triangulation as a triangle strip

Post by pgimeno »

How would you convert this polygon to a triangle strip without adding vertices?

Edit: Never mind, I saw how.
Attachments
star.png
star.png (4.29 KiB) Viewed 3795 times
monolifed
Party member
Posts: 192
Joined: Sat Feb 06, 2016 9:42 pm

Re: Triangulation as a triangle strip

Post by monolifed »

what about this one?
Attachments
teeth.png
teeth.png (953 Bytes) Viewed 3780 times
User avatar
darkfrei
Party member
Posts: 419
Joined: Sat Feb 08, 2020 11:09 pm

Re: Triangulation as a triangle strip

Post by darkfrei »

monolifed wrote: Mon Aug 16, 2021 8:54 pm what about this one?
You can use degenerate triangles :)
wiki wrote:The degenerate triangles effectively introduce discontinuities or "jumps" to the strip.
:awesome: Falling in LÖVE :awesome:
I Löve Lua and Love2D
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 49 guests