[vtk-developers] [VTK 0013300]: VTKCubeAxesActor:ComputeTickSize ; does not always honor changes when custom range is set. (Fix included)

Mantis Bug Tracker mantis at public.kitware.com
Tue Jul 10 17:30:04 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://vtk.org/Bug/view.php?id=13300 
====================================================================== 
Reported By:                Lawrence
Assigned To:                
====================================================================== 
Project:                    VTK
Issue ID:                   13300
Category:                   (No Category)
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     backlog
Project:                    ParaViewPro 
Type:                       incorrect functionality 
====================================================================== 
Date Submitted:             2012-07-10 16:30 CDT
Last Modified:              2012-07-10 16:30 CDT
====================================================================== 
Summary:                    VTKCubeAxesActor:ComputeTickSize ; does not always
honor changes when custom range is set. (Fix included)
Description: 
Issue found with a patched*(footnote) version Paraview 3.14.1 so I don't know
which version of vtk I should file this under.

PROBLEM: When SetXRange is used to set a custom range, the tick and labels may
not updated.

Cause: In vtkCubeAxesActor::ComputeTickSize(double bounds[6]) {
(identical code for Y and Z axes omitted)

   bool xRangeChanged = this->LastXRange[0] != bounds[0] || ...
   
   if (!(xRangeChanged || yRangeChanged || ...))
    {
    // no need to re-compute ticksize.
    return false;   <<<<< **** RETURNS EARLY HERE WHEN IT SHOULD NOT. ****
    }                   

So... why is LastXRange's value incorrect? Later in the same function, we have
the following logic. 

   this->LastXRange[0] = (this->XAxisRange[0] == VTK_DOUBLE_MAX ?
                                  bounds[0] : this->XAxisRange[0]);

->The fix is to check for changes in both the range AND the bounds.

The attached cxx file includes a new field "LastBound" to catch these kinds of
modifications that need to force an update to the tick marks.
The main changes are in ComputeTickSize and are highlighted below -


vtkCubeAxesActor::ComputeTickSize(double bounds[6])
{
...

  double xrange[2], yrange[2], zrange[2];

  xrange[0] = (this->XAxisRange[0] == VTK_DOUBLE_MAX ?
                                  bounds[0] : this->XAxisRange[0]);
 ...
  bool xRangeChanged = this->LastXRange[0] != xrange[0] || ...

Also do explicit bounds check -
  bool boundsChanged = this->LastBounds[0] != bounds[0] ||
                      ...
                       this->LastBounds[5] != bounds[5];

// A new boundsChange check -
  if (!(xRangeChanged || yRangeChanged || zRangeChanged || boundsChanged) &&



And at the end of the function, we cache the range AND bounds we used-
  this->LastXRange[0] = xrange[0];
  this->LastXRange[1] = xrange[1];
  this->LastYRange[0] = yrange[0];
  this->LastYRange[1] = yrange[1];
  this->LastZRange[0] = zrange[0];
  this->LastZRange[1] = zrange[1];
  for( int i =0; i < 6; i++)
    {
    this->LastBounds[0] = bounds[0];
    }

Footnote:
This will not affect the official Paraview until 
http://vtk.org/Bug/view.php?id=13093
is included.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-07-10 16:30 Lawrence       New Issue                                    
2012-07-10 16:30 Lawrence       File Added: vtkCubeAxesActor.cxx                
   
======================================================================




More information about the vtk-developers mailing list