There is at least one numerical error in vtkTextureMapToSphere.cxx. People have been complaining about this or vtkTextureMapToCylinder since 1999, so it must be too hard for the VTK team to handle! <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/tsmileys2/01.gif"><br><br>I have a Bandaid fix that works for a structured sphere source, but I don't know how to handle the general case. The polar regions are still distorted, and PreventSeamOn still ruins the scale of the entire map, but now at least there is no jumbled band of colors from North Pole to South Pole along longitude 0 degrees. <br><br>To see my two-line fix, see the insertion in my original message below.<br><br><br><br><b><i>John Davis <gcubed.developer@yahoo.com></i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> I have a complete working VTK 5.0.3/C++ application that includes these
lines:<br><br> vtkTextureMapToSphere *textureMapper = vtkTextureMapToSphere::New();<br> textureMapper->SetInput(globeOverlay->GetOutput());<br> textureMapper->PreventSeamOff(); <br><br>The application displays a rotating 3D globe with earth geography mapped from an 2D image to a 2D texture. The 2D image is rectangular and linear in X and Y with the prime meridian in the center, 180 longitude on the right edge, and, -180 longitude on the left edge. From vtkTransformTextureCoords I use<br><br> ->AddPosition(0.5,0.0,0.0) <br> ->FlipROn()<br><br>My application does exactly what it is supposed to do except that the prime meridian is a jumbled narrow band of colors and there is a visible seam in the Pacific at 180.<br><br>If I change only this line:<br><br> textureMapper->PreventSeamOn(); <br><br>the prime meridan closes, but the entire geography is compressed and
duplicated in both the eastern and western hemispheres.<br><br>No amount of experimenting with vtkTransformTextureCoords scaling, positioning, and flipping has restored the correct geography.<br><br>I'm beginning to believe that this code from vtkTextureMapToSphere.cxx is causing the problem, but it looks logical. What am I missing?<br><br> if ( this->PreventSeam )<br> {<br> tc[0] = thetaX / vtkMath::Pi();<br> }<br> else<br> {<br> tc[0] = thetaX / (2.0*vtkMath::Pi());<br> <span style="font-weight: bold;"> </span><span style="background-color: rgb(255, 0, 0); font-weight: bold;"> if ( fabs(thetaY) < 0.002)</span><br style="background-color: rgb(255, 0, 0); font-weight: bold;"><span style="background-color: rgb(255, 0, 0);"><span style="font-weight:
bold;"> thetaY = -thetaY</span>;</span><br> if ( thetaY < 0.0 )<br> {<br> tc[0] = 1.0 - tc[0];<br> }<br> }<br><br> <br><br>...</blockquote><br><p> 
<hr size=1><a href="http://us.rd.yahoo.com/evt=48250/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v9.php?o=US2226&cmp=Yahoo&ctv=AprNI&s=Y&s2=EM&b=50">Pinpoint customers </a>who are looking for what you sell.