Sorry i have not had much time to look at this. The problem is the rather simplistic way I have calculated ThisUpos. Obviously it must go to 0 and back to 1, but as it stands it will only do this properly with an even number of sides and besides which mirroring things like this requires a texture to suit. Now I was going to attempt to fix this but then I noticed Todds' original code had a problem with smoothing the normals across the seam in some cases.
This is due to a slight offfset in the vertex positions between the first and final calculated x position (most noticeable with X anyway) on the circumference of the main body and is I think due to floating point precision issues on the result returned from the cos function which is started at 90 degrees and ends at 450 degrees. The way siderotangle is stepped by means of addition probably compounds the issue and adds a little more innacuracy.
It occured to me this might be relevant to your ripple function, whatever that does, and so to fix that modify the Siderotangle step code in the two loops to
If i<(verticalsegments-1) Then SideRotAngle#=SideRotAngle#+div# Else Siderotangle#=90
This should ensure that the finals verts will be positioned in exactly the same place as the first ones which may help.
This is due to a slight offfset in the vertex positions between the first and final calculated x position (most noticeable with X anyway) on the circumference of the main body and is I think due to floating point precision issues on the result returned from the cos function which is started at 90 degrees and ends at 450 degrees. The way siderotangle is stepped by means of addition probably compounds the issue and adds a little more innacuracy.
It occured to me this might be relevant to your ripple function, whatever that does, and so to fix that modify the Siderotangle step code in the two loops to
If i<(verticalsegments-1) Then SideRotAngle#=SideRotAngle#+div# Else Siderotangle#=90
This should ensure that the finals verts will be positioned in exactly the same place as the first ones which may help.