# add_triangle_fan ( ) in godot

Attention Topic was automatically imported from the old Question2Answer platform.

I don’t understand the add_triangle_fan() function
what does it mean even though i know how to create SurfaceTool?
I can’t find much documentation about it
Can you explain it to me, please?
the hardest thing is its parameters

Agree with you that the documentation should provide more examples on how their mesh tools are to be used because as is, it expects you to have prior extensive knowledge of openGL syntax.

Even with that knowledge winding orders are completely different and … getting back on topic

## Triangle Fan

So TRIANGLE_FAN is used for drawing complex shapes like polygons (not Pokédex entry #137) with the first vertex being central and additional vertices literally winding around like a Chinese/Japanese paper fan.

The parameters are the same as used for Surface tool but more bundled using arrays instead of having to add one vertex / color / uv / normal at a time

You can run a for loop like this

``````#not actual code

var vertices = PoolVector3Array()
var normals = PoolVector3Array()
var uvs = PoolVector2Array()
var colors = PoolColorArray()

vertices.resize(size_y * size_x)
normals.resize(vertices.size())
uvs.resize(vertices.size())
colors.resize(vertices.size())

for y in range(height):
for x in range(width):
vertices[ y * width + x ] = Vector3(-PI + 2 * x * PI / (width -1), -PI / 2 + y * PI / (height-1), 0)
normals[ y * width + x ] = vertices[ y * width + x ].normalize()
uvs[ y * width + x ] = Vector2(y / 2, x / 2)
colors[ y * width + x ] = Color.red
add_triangle_fan(vertices, uvs, colors, [], normals, [])
``````

As opposed to doing

``````var st = SurfaceTool.new()