View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013829VTK(No Category)public2013-01-29 11:552016-07-22 14:18
ReporterJoó Péter 
Assigned ToHaocheng Liu 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version5.10.1 
Target Version7.1.0Fixed in Version6.2.0 
Summary0013829: vtkAssembly::GetBounds blindly adds bounds which are uninitialized
DescriptionAssume you have two spheres in an assembly and a clipping plane which entirely clips one of the sphere out but it keeps the other intact.

If you query the bounding box of that assembly then it returns with absolutely wrong bounding box coordinates.

The reason behind is that the vtkAssembly::GetBounds accumulates bounds but never checks weather an internal part!s bound is initialized or not. initialized or not.

Details of the investigation:
In file VTK5.10.1\Rendering\vtkAssembly.cxx at line 393 the following bound is an uninitialized bound :

line 393: bounds = prop3D->GetBounds();

Debugger tells that this bound is:

bounds[0] 1.0000000000000000 double
bounds[1] -1.0000000000000000 double
bounds[2] 1.0000000000000000 double
bounds[3] -1.0000000000000000 double
bounds[4] 1.0000000000000000 double
bounds[5] -1.0000000000000000 double

I recommend the following change in VTK inside vtkAssembly::GetBounds method:

ORIGINAL CODE
      propVisible = 1;
      prop3D->PokeMatrix(path->GetLastNode()->GetMatrix());
      bounds = prop3D->GetBounds();
      prop3D->PokeMatrix(NULL);

PROPOSAL
      prop3D->PokeMatrix(path->GetLastNode()->GetMatrix());
      bounds = prop3D->GetBounds();
      prop3D->PokeMatrix(NULL);
      if (!vtkMath::AreBoundsInitialized(bounds))
            continue;
      propVisible = 1;

I added an optional project as an attachment to test it with a debugger just in case.
Steps To ReproduceUsed user supplied badbounds.cxx to reproduce
TagsNo tags attached.
ProjectTBD
Typeincorrect functionality
Attached Fileszip file icon badbounds.zip [^] (1,628 bytes) 2013-01-29 11:55

 Relationships

  Notes
(0031055)
Dave DeMarle (administrator)
2013-06-25 13:29

Thanks. Would you mind submitting this in the form of a gerrit topic to facilitate automated testing and code review? For details on how to do so see http://www.vtk.org/Wiki/VTK/Git/Develop [^]
(0031080)
Joó Péter (reporter)
2013-06-26 03:24

Unfortunately I don't have to required amount of time to do that.
Also I think I fairly detailed the problem and its resolution, so anyone can integrate it into VTK now :)
(0032136)
Serge Lalonde (reporter)
2014-01-07 14:20

I suggest changing the "if" in the code modification to this instead:

      if (bounds == NULL || !vtkMath::AreBoundsInitialized(bounds))
            continue;

since most other code that checks the validity of bounds also check to ensure that the return value of GetBounds() isn't NULL (ex: vtkRenderer::ComputeVisiblePropBounds())
(0034088)
Serge Lalonde (reporter)
2015-01-16 16:43

I'm updating to VTK 6.1 and I can validate that this bug is still present. It's fine for me because I know about this bug and I can apply the fix myself and rebuild, but others might waste time on it. Can't an experienced VTK contributor apply the 4 line change?
(0036302)
Berk Geveci (administrator)
2016-07-06 16:50

Setting bugs that have not been touched in 1 year to expired. If important, please re-open.
(0036548)
Haocheng Liu (developer)
2016-07-22 14:18

Tested with VTK7.0.0. It seems that this bug has been fixed. All the output looks fine.

 Issue History
Date Modified Username Field Change
2013-01-29 11:55 Joó Péter New Issue
2013-01-29 11:55 Joó Péter File Added: badbounds.zip
2013-06-25 13:29 Dave DeMarle Note Added: 0031055
2013-06-26 03:24 Joó Péter Note Added: 0031080
2013-07-22 21:05 Dave DeMarle Assigned To => Dave DeMarle
2013-07-22 21:05 Dave DeMarle Status backlog => todo
2013-08-12 17:44 Dave DeMarle Status todo => backlog
2014-01-07 14:20 Serge Lalonde Note Added: 0032136
2014-01-07 16:34 Bill Lorensen Assigned To Dave DeMarle => Bill Lorensen
2014-01-07 16:34 Bill Lorensen Reproducibility have not tried => always
2014-01-07 16:34 Bill Lorensen Status backlog => gerrit review
2014-01-07 16:34 Bill Lorensen Fixed in Version => 6.2.0
2014-01-07 16:34 Bill Lorensen Target Version => 6.2.0
2014-01-07 16:34 Bill Lorensen Steps to Reproduce Updated
2015-01-16 16:43 Serge Lalonde Note Added: 0034088
2016-07-06 16:50 Berk Geveci Status gerrit review => expired
2016-07-06 16:50 Berk Geveci Note Added: 0036302
2016-07-22 13:14 Haocheng Liu Status expired => backlog
2016-07-22 13:14 Haocheng Liu Status backlog => active development
2016-07-22 13:14 Haocheng Liu Target Version 6.2.0 => 7.1.0
2016-07-22 13:14 Haocheng Liu Assigned To Bill Lorensen => Haocheng Liu
2016-07-22 14:18 Haocheng Liu Note Added: 0036548
2016-07-22 14:18 Haocheng Liu Status active development => closed
2016-07-22 14:18 Haocheng Liu Resolution open => fixed


Copyright © 2000 - 2018 MantisBT Team