View Full Version : Polygon tesselation

Hello,

im interested, is someone knew which algo use p. tesselation for traversing vertices, or does it even traverse it ;-), and where could i find formula or formulas ?

Thanx.

knackered

04-12-2002, 10:32 AM

For every triangle...

Calculate area of triangle.

If area is greater than your threshold area

find the longest edge

find the midpoint on this edge

Create a new vertex at this midpoint

delete triangle, and create 2 new triangles out of the 4 vertices

loop back until all triangles processed

repeat the above until no triangles have an area above your threshold area.

jwatte

04-13-2002, 08:46 AM

You have to split all triangles sharing the longest edge at the same time, else you'll get T junctions. That means, for manifold meshes, you delete 2 triangles and add 4 triangles for each edge split.

knackered

04-13-2002, 09:36 AM

Oh yeah http://www.opengl.org/discussion_boards/ubb/smile.gif

knackered, jwatte,

Did I misunderstand the question ?

For me polygon tesselation is the method that breaks a polygon into triangles.

In the algorithm knackered described, he starts with "for every triangle" which supposes that you already have a triangulation...

Or perhaps it's just me on monday morning http://www.opengl.org/discussion_boards/ubb/wink.gif !

Regards.

Eric

P.S.: sz, I tried to find info about triangulation a while ago and if that's what you're interested in, look for "Delaunay triangulation" on the web.

Devulon

04-15-2002, 02:09 AM

Guys please eaze up a little here. Yes any polygon can be broken down into triangles. If you are using opengl and want any form of speed then your "polygons" probably already are composed of triangles. Even if they aren't properly dividing an arbitrary polygon into triangles is probably more difficult that simply tesselating triangles. Chance for concavities and you know the jazz.

The basic rule of splitting the longest edge works and works great. Most of the time though the new vertices are perturbed slightly based on the underlying mesh. Very similar to bump mapping where you calculate a du,dv, in this case its a dx,dy and I'm not going into detail. The point being that the newly created vertices are usually smoothed so that the surface is closer to being a curve. Basically implementing a MeshSmooth as in 3d Studio Max, Maya or whatever resonably decent modeling package.

Happy Coding.

Originally posted by Devulon:

Guys please eaze up a little here.

Can I ask you why you say that ?

Regards.

Eric

Thanx guys,

so lets sum, let take code :

------

For every triangle...

Calculate area of triangle.

If area is greater than your threshold area

find the longest edge

find the midpoint on this edge

Create a new vertex at this midpoint

* delete triangle, and create 2 new triangles out of the 4 vertices

loop back until all triangles processed

repeat the above until no triangles have an area above your threshold area.

-----

hm, i had simmilar idea, but in code, i marked position with *, i think that there is no need to delete current triangle 'cos when we split it, that triangle "become" two other, and so on http://www.opengl.org/discussion_boards/ubb/wink.gif

And for Eric question:

"In the algorithm knackered described, he starts with "for every triangle" which supposes that you already have a triangulation..."

well when i asked, i didn't think about triangulation, but, is known, every poly can represent with triangles, i think with infinity triangles (nice theorem http://www.opengl.org/discussion_boards/ubb/wink.gif ) .

PS.

maybe ill need to look in Mesa code, and see how they implemented this

Thanks guys

Sanel

Kilam Malik

04-15-2002, 05:06 AM

I hope I did not understand the question wrong... you wanted an algorithm how to triangulate a polygon? The Seidel Algorithm is often used, e.g. http://www.cs.unc.edu/~dm/CODE/GEM/chapter.html or a search on Google on "Seidel Algorithm".

It basically makes horizontal lines at each vertex and triangulates there.

Kilam.

[This message has been edited by Kilam Malik (edited 04-15-2002).]

Devulon

04-15-2002, 07:12 AM

I said eaze up just as a response to everyone here always being so technical. It was meant as a joke nothing more. It's just a general impression I have gotten in the advances forum. This isn't directed at you Eric, its just that some people seem to be really anal. Don't think anything about what I said.

( :

Devulon

Devulon, I didn't take it as an offense, I was just wondering what you meant http://www.opengl.org/discussion_boards/ubb/wink.gif!

Regards.

Eric

billy

04-16-2002, 01:01 AM

I think that Kilam was the only one that answered the question.

However triangle subdivision is also an interesting topic. I wonder why the criteria is the triangle's area. I thought it would be something more like aspect ratio. I guess it depends on the type of mesh you want.

Originally posted by billy:

I think that Kilam was the only one that answered the question.

So you didn't like my reference to Delaunay Triangulation http://www.opengl.org/discussion_boards/ubb/wink.gif ?

Regards.

Eric

billy

04-16-2002, 02:51 AM

http://www.opengl.org/discussion_boards/ubb/biggrin.gif

Wow people,

i thought that will be only few answers on this topic http://www.opengl.org/discussion_boards/ubb/smile.gif

I visited Kalim's link, and that algo is something what im looking for.

But, http://www.opengl.org/discussion_boards/ubb/wink.gif, i also noticed increesing time with number of vertices. Well now in my head http://www.opengl.org/discussion_boards/ubb/wink.gif there is few methods how to avoid this, and speed up things.

Devolution, plese could you explain little bit your post and methods in 3DsMAX and Maya ?

PS.

anyone knows nice link with nice collection of usefull algos ?

Devulon

04-16-2002, 06:58 AM

I wish i had an algorithm. I haven't started doing subdivision yet (short of really simply subdivision on terrain). That project was short lived. Anyway that code is worthless so I won't waste your time.

To clarify my post I was simply pointing to the fact that any modelling/animation package worth its salt will have some form of MeshSmoothing which is basically subdivision/Tesselation. Whatever you want to call it. The only real difference is that Tesselation doesn't change topology and Mesh Smoothing intentionally does change topology (to smooth !!).

More and More recently with the advent of faster computers and faster video cards people are starting to implement things such as tesselation in realtime. These are algorithms that for a long time were part of modelling but simply couldn't be done in realtime.

Devulon

jwatte

04-16-2002, 06:55 PM

I commented on knackereds post, I did not answer the question. Sorry.

Here's one (naive, but working) approach to tesselate a polygon into triangles, supporting concave polygons as long as they are not self-overlapping.

While( polygon has > 3 vertices )

Find first sequence of 3 successive vertices which describes a triangle which is INSIDE the polygon

Remember this triangle in your output set

Remove the middle vertex from the polygon

Note that the "Find" part is guaranteed to terminate. The self-overlapping / holes-inside case is MUCH harder. Do a google and read up on it if you don't believe me :-)

If the polygon is convex, any sequence of 3 successive vertices will describe a triangle that's inside the polygon, and thus this algorithm would generate a fan out of a convex polygon.

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.