[vtkusers] vtkCubeAxesActor2D min/max tick mark adjustment

Adam Reid areid at lumerical.com
Fri Dec 2 18:32:57 EST 2011


I’ve noticed that when using the vtkCubeAxesActor2D class the min and max tick marks show up in a slightly strange location. Instead of showing up exactly on the corners of the cube they show up slightly offset, the min tick mark is a little to the positive side of its corresponding value and the max tick mark is a little to the negative side. Initially I thought I might have been using the class incorrectly, but I’ve looked at a number of examples and other user’s code and it seems the axes always work this way. Does anyone know whether this is the intended behavior or a bug? Any ideas on how to adjust it so the tick marks show up right at the corners of the cube? Here is a simple example that shows the issue. The geometry is an outline of a unit cube. When it renders, the labels for 0 and 1 are a little offset from the corners of the cube.

import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
outline = vtk.vtkOutlineSource()
outline.SetBounds(0,1,0,1,0,1)
mapOutline = vtk.vtkPolyDataMapper()
mapOutline.SetInputConnection(outline.GetOutputPort())
outlineActor = vtk.vtkActor()
outlineActor.SetMapper(mapOutline)
outlineActor.GetProperty().SetColor(0,0,1)
renWin = vtk.vtkRenderWindow()
renWin.SetSize(600, 600)
ren = vtk.vtkRenderer()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
axes = vtk.vtkCubeAxesActor2D()
axes.SetInput(outline.GetOutput())
axes.SetCamera(ren.GetActiveCamera())
ren.AddViewProp(axes)
ren.AddViewProp(outlineActor)
iren.Initialize()
ren.ResetCamera()
renWin.Render()
iren.Start()

Cheers,

Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111202/e74e6f15/attachment.htm>


More information about the vtkusers mailing list