**Bug #700**: CreateCylinder has messed up vertexes

**Product:**

TV3D SDK 6.5

**Language:**

Visual Basic.NET

**Current State:**

Closed

**Resolution:**

Fixed

**Created On:**

May 15th, 2007

**Last Modified:**

May 21st, 2007

**Reported By:**

EagleEye

Created a 4 sided cylinder using scene.createscenebuilder, then mesh.createcylinder. I move the center of the mesh using mesh.SetMeshCenter to the BoundingBoxMin Y value (so the new center is at the bottom of the cylinder).

When I get the geometry, and iterate through the array of vertexes, I get 10 of them, 5 on top, 5 on bottom. These are the coordinates of the vertexes on the bottom:

100, 0

-0.0000941749458 , -100

100, -0.000125566585

-100 , 0.00006278329

0.0000313916462 , 100

Notice #1 and #3 are very close together, and there is no vertex at 0,0 as would be expected.

When manipulating those vertexes out by multiplying the X and Y coordinates by 2 (thus doubling the width of the bottom), the entire mesh gets messed up, as shown here: (Link)

Without this vertex manipulation, the box looks normal. The coordinates shown above are from before any vertex manipulation.

I think I figured out what's going on here... when creating the cylinder, it's creating the sides one at a time, and wrapping them around that central point... the last side it creates SHOULD have its edge line up exactly with the first edge it created and even merge the vertexes, but it's slightly off due to floating point math fuzziness... the last edge, therefore, is VERY close together, but not quite right. Those vertexes need to be merged together as one to complete the circle.

When I get the geometry, and iterate through the array of vertexes, I get 10 of them, 5 on top, 5 on bottom. These are the coordinates of the vertexes on the bottom:

100, 0

-0.0000941749458 , -100

100, -0.000125566585

-100 , 0.00006278329

0.0000313916462 , 100

Notice #1 and #3 are very close together, and there is no vertex at 0,0 as would be expected.

When manipulating those vertexes out by multiplying the X and Y coordinates by 2 (thus doubling the width of the bottom), the entire mesh gets messed up, as shown here: (Link)

Without this vertex manipulation, the box looks normal. The coordinates shown above are from before any vertex manipulation.

I think I figured out what's going on here... when creating the cylinder, it's creating the sides one at a time, and wrapping them around that central point... the last side it creates SHOULD have its edge line up exactly with the first edge it created and even merge the vertexes, but it's slightly off due to floating point math fuzziness... the last edge, therefore, is VERY close together, but not quite right. Those vertexes need to be merged together as one to complete the circle.

# Comments:

**Posted by SylvainTV on May 21st, 2007 at 10:16 PM**

fixed a little the inaccuracy on the duplicated vertices.