x


Generating Triangles Given a Set of Points

Speaking only from a 2-dimensional standpoint, given a set of points (vertices), how can I generate the triangles necessary to fill in the object that the points were made from?

And what I mean by this is, if I specify the "outer edge" of this set of points, I need something to calculate all the triangles that will properly "fill" this object in. It shouldn't matter if the object is concave or not.

I realize this is confusing, so I've drawn a helpful diagram. :)

alt text

See... what I want is, if I give this algorithm a set of line segments (point pairs), say:

AB, BC, CD, DE, EF, FG, GH, HA

It should then be able to compute the triangles necessary to fill in the object, utilizing the lines I gave it. So if you give it 8 points, depending on the configuration, it will compute either the triangle set on the left, or right.

Does something like this exist? I'm sure it has to in some form or another, I mean... how else do 3D modelling programs generate triangles like this? If anyone has any information about something that I could possibly use inside of Unity like this, that would be excellent. Thanks!

more ▼

asked Apr 21 '10 at 08:04 AM

qJake gravatar image

qJake
11.6k 43 78 161

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Check out the Triangulator script on the wiki.

more ▼

answered Apr 21 '10 at 08:27 AM

Eric5h5 gravatar image

Eric5h5
80.3k 42 132 521

Thanks! I'll definitely give this a try tomorrow. It sounds exactly like what I'm looking for. If it works, I'll +accept. ;)

Apr 21 '10 at 08:38 AM qJake

This worked splendidly, thanks! :)

Apr 21 '10 at 11:52 PM qJake

Excellent script, oddly difficult to find searching for: Procedural, Mesh, Generation, Draw, draw mesh, triangles, polygon

maybe here are some extra keywords for the search engine for future lookers :D

Apr 20 '11 at 03:48 PM davebuchhofer
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1366
x93
x62
x45

asked: Apr 21 '10 at 08:04 AM

Seen: 2593 times

Last Updated: Apr 21 '10 at 08:04 AM