<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">I am trying to show a rectangle with a photo on + axes. The rectangle is centered at (0,0,0), and the size is (1,1). I'm using vtkCubeAxesActor2D for the axes.</div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
The axes do not fit the rectangle correctly -- it doesn't go from edge to edge. The ticks seem to be positioned at -0.45 to 0.45 instead of -0.5 to 0.5</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><a href="https://dl.dropbox.com/u/8597999/axes.jpg" target="_blank" style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">https://dl.dropbox.com/u/8597999/axes.jpg</a><br clear="all" style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
Is this a VTK bug or something wrong in my code?</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
Here is my code:</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><div> // Read the image which will be the texture</div><div> vtkJPEGReader jPEGReader = vtkJPEGReader.New();</div>
<div> jPEGReader.SetFileName("F:\\pixortphotos\\quitesomephotos\\IMG_1735.JPG");</div><div><br></div><div> // Create a plane</div><div> vtkPlaneSource planeSource = vtkPlaneSource.New();</div>
<div> planeSource.SetCenter(0.0, 0.0, 0.0);</div><div> planeSource.SetNormal(0.0, 0.0, 1.0);</div><div><br></div><div> // Apply the texture</div><div> vtkTexture texture = vtkTexture.New();</div>
<div> texture.SetInputConnection(jPEGReader.GetOutputPort());</div><div><br></div><div> vtkTextureMapToPlane texturePlane = vtkTextureMapToPlane.New();</div><div> texturePlane.SetInputConnection(planeSource.GetOutputPort());</div>
<div><br></div><div> vtkPolyDataMapper planeMapper = vtkPolyDataMapper.New();</div><div> planeMapper.SetInputConnection(texturePlane.GetOutputPort());</div><div><br></div><div> vtkActor texturedPlane = vtkActor.New();</div>
<div> texturedPlane.SetMapper(planeMapper);</div><div> texturedPlane.SetTexture(texture);</div><div><br></div><div> // Create components of the rendering subsystem</div><div> //</div>
<div> vtkRenderer renderer = _renderWindowControl.RenderWindow.GetRenderers().GetFirstRenderer();</div><div> renderer.SetBackground(1.0, 1.0, 1.0);</div><div> vtkRenderWindow renWin = _renderWindowControl.RenderWindow;</div>
<div><br></div><div> // Axes</div><div> </div><div> // Create a text property for both cube axes</div><div> var tprop = vtkTextProperty.New();</div><div> tprop.SetColor(0.3, 0.3, 0.3);</div>
<div> tprop.ShadowOn();</div><div><br></div><div> var normals = vtkPolyDataNormals.New();</div><div> normals.SetInputConnection(planeSource.GetOutputPort());</div><div><br></div><div> var axes = vtkCubeAxesActor2D.New();</div>
<div> axes.SetInput(planeSource.GetOutput());</div><div> axes.SetCamera(renderer.GetActiveCamera());</div><div> axes.SetLabelFormat("%6.4g");</div><div> axes.SetFlyModeToOuterEdges();</div>
<div> axes.SetFontFactor(1.0);</div><div> axes.SetAxisTitleTextProperty(tprop);</div><div> axes.SetAxisLabelTextProperty(tprop);</div><div> axes.GetProperty().SetColor(0, 0, 0);</div>
<div> axes.SetYAxisVisibility(0);</div><div> </div><div> renderer.AddViewProp(axes);</div><div><br></div><div> // Interactor</div><div> vtkRenderWindowInteractor renderWindowInteractor = vtkRenderWindowInteractor.New();</div>
<div> renderWindowInteractor.SetRenderWindow(renWin);</div><div> var interactorStyle = vtkInteractorStyleImage.New();</div><div><br></div><div> renderWindowInteractor.SetInteractorStyle(interactorStyle);</div>
<div><br></div><div> vtkCamera camera = renderer.GetActiveCamera();</div><div> camera.ParallelProjectionOn();</div><div> </div><div> axes.SetCamera(camera);</div><div><br></div><div>
// Add the actors to the renderer, set the window size</div><div> renderer.AddActor(texturedPlane);</div><div> renderer.ResetCamera();</div></div>