ngon_tessellate in blender 2.69

Hi,

It seems i can’t figure out how to use this tool.

In the python console:

from bpy_extras.mesh_utils import ngon_tessellate
# six points on a rectangle 
a = Vector((0.0, 0.0, 0.0))
b = Vector((1.0, 0.0, 0.0))
c = Vector((1.0, 1.0, 0.0))
d = Vector((1.0, 0.0, 0.0))
e = Vector((-1.0, -1.0, 0.0))
f = Vector((-1.0, 0.0, 0.0))

print( ngon_tessellate([a,b,c,d,e,f], [0,1,2]) ) 
# => [[1,2,0]]
# ok

print( ngon_tessellate([a,b,c,d,e,f], [0,1,2,3,4]) )
# => [(4, 3, 0)]
# How can it loop over 5 vertices forming a convex shape with 1 triangles ?

print( ngon_tessellate([a,b,c,d,e,f], [0,1,2,3,4,5]) )
# => [(4, 3, 0), (4, 0, 5)]
# How can it loop over 6 vertices forming a convex shape with 2 triangles ?

What am i doing wrong here ?

It’s not convex. Draw it. Points “b” and “d” are the same, so it’s degenerate.

You’re right, i can’t believe i messed up the vector coords… Thanks.

what are you planning on doing with this? does this make sure all tessellation are square?

I use an external tool to build a constrained delaunay triangulation. I need to provide a point inside the boundary of each hole (wich can be convex or concave), so i use the tessellation tool to fill the holes and get the center of any newly created polygon as input for the delaunay triangulator.