View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013300VTK(No Category)public2012-07-10 17:302012-07-12 18:08
ReporterLawrence 
Assigned ToSebastien Jourdain 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version5.8.0 
Target VersionFixed in Version 
Summary0013300: VTKCubeAxesActor:ComputeTickSize ; does not always honor changes when custom range is set. (Fix included)
DescriptionIssue 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.
TagsNo tags attached.
ProjectParaViewPro
Typeincorrect functionality
Attached Filescxx file icon vtkCubeAxesActor.cxx [^] (84,324 bytes) 2012-07-10 17:30
cxx file icon vtkCubeAxesActor-v2.cxx [^] (84,320 bytes) 2012-07-12 16:44

 Relationships

  Notes
(0028762)
Sebastien Jourdain (developer)
2012-07-11 08:50

I'm currently working on this set of classes to support oriented bounding box, so in the same time I try to fix some other culprit.
(0028763)
Lawrence (reporter)
2012-07-11 15:32

OBB would be useful.

By the way, my suggested bug fix has a bug at the end...
this->LastBounds[0] = bounds[0];
should be
this->LastBounds[i] = bounds[i];
(0028764)
Sebastien Jourdain (developer)
2012-07-11 15:38

I've noticed... Don't worry I've fixed it as well. ;-)
(0028768)
Lawrence (reporter)
2012-07-12 16:37

("The bug that refuses to die...")
Yesterday's alleged fix is incomplete: There are still times when the ticks are not updated because the later 'ifs' do not fire...
 if (...)
    {
    this->AdjustTicksComputeRange(this->XAxes, bounds[0], bounds[1]);
    this->BuildLabels(this->XAxes);
    this->UpdateLabels(this->XAxes, 0);

An improved fix is to group detected changes by axis (range and/or bounds) and then use that in the subsequent ifs...
i.e.
// Ticks need updating if the Range and/or Bounds are changed
bool xChanged = this->LastXRange[0] != xrange[0] ||
this->LastXRange[1] != xrange[1] ||
this->LastBounds[0] != bounds[0] ||
this->LastBounds[1] != bounds[1];

and later...
  if (xChanged)
    { // Bounds and/or range change causes tick recalculation ...
    this->AdjustTicksComputeRange(this->XAxes, bounds[0], bounds[1]);

---
I'll attach a file with these changes. I'm currently working on Paraview bug 0013093: With the above changes, I'm starting to see sensible axes when the object is scaled.
Best,
Lawrence.
(0028770)
Sebastien Jourdain (developer)
2012-07-12 16:47

I've noticed that as well, and I've been more eager than you by simply doing ;-)

if (xRangeChanged || boundsChanged)
if (yRangeChanged || boundsChanged)
if (zRangeChanged || boundsChanged)
(0028771)
Sebastien Jourdain (developer)
2012-07-12 16:48

http://review.source.kitware.com/#/t/915/ [^]

 Issue History
Date Modified Username Field Change
2012-07-10 17:30 Lawrence New Issue
2012-07-10 17:30 Lawrence File Added: vtkCubeAxesActor.cxx
2012-07-11 08:44 Sebastien Jourdain Assigned To => Sebastien Jourdain
2012-07-11 08:44 Sebastien Jourdain Status backlog => tabled
2012-07-11 08:50 Sebastien Jourdain Note Added: 0028762
2012-07-11 15:32 Lawrence Note Added: 0028763
2012-07-11 15:38 Sebastien Jourdain Note Added: 0028764
2012-07-12 14:51 Sebastien Jourdain Assigned To Sebastien Jourdain =>
2012-07-12 14:51 Sebastien Jourdain Assigned To => Sebastien Jourdain
2012-07-12 16:37 Lawrence Note Added: 0028768
2012-07-12 16:44 Lawrence File Added: vtkCubeAxesActor-v2.cxx
2012-07-12 16:47 Sebastien Jourdain Note Added: 0028770
2012-07-12 16:48 Sebastien Jourdain Note Added: 0028771
2012-07-12 18:08 Sebastien Jourdain Status tabled => closed
2012-07-12 18:08 Sebastien Jourdain Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team