| View Issue Details [ Jump to Notes ] | [ Print ] |
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0004507 | VTK | (No Category) | public | 2007-02-27 16:34 | 2016-08-12 09:54 |
|
| Reporter | Bill McGrory | |
| Assigned To | Sebastien Barre | |
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | moved | |
| Platform | | OS | | OS Version | |
| Product Version | | |
| Target Version | | Fixed in Version | | |
|
| Summary | 0004507: vtkActor::GetBounds returns unitialized bounds when no mapper is connected |
| Description | The code for vtkActor::GetBounds blindly returns the actor's Bounds as the bounds, and doesn't check to see if it is initialized or not.
There is a check in the mapper code to see if the mapper's bounds are initialized. if not, then it returns a null pointer to bounds.
I believe that a null bounds should be returned if there is no mapper, and the actor's bounds are unitialized.
This has consequences for vtkAssembly::GetBounds because the assembly does not check for null pointer return on the child GetBounds calls.
Thus, if you include an actor in an assembly that does not have a mapper, then the values -1, and 1 will be included in the collective bounds calculation for the assembly, thus returning incorrect bounds. |
| Tags | No tags attached. |
|
| Project | |
| Type | |
|
| Attached Files | vtkActor.cxx.patch [^] (641 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]Index: Rendering/vtkActor.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkActor.cxx,v
retrieving revision 1.132
diff -u -r1.132 vtkActor.cxx
--- Rendering/vtkActor.cxx 18 Oct 2006 16:38:48 -0000 1.132
+++ Rendering/vtkActor.cxx 28 Feb 2007 15:29:42 -0000
@@ -295,7 +295,14 @@
// get the bounds of the Mapper if we have one
if (!this->Mapper)
{
- return this->Bounds;
+ if (vtkMath::AreBoundsInitialized(this->Bounds))
+ {
+ return this->Bounds;
+ }
+ else
+ {
+ return NULL;
+ }
}
bounds = this->Mapper->GetBounds();
vtkAssembly.cxx.patch [^] (2,845 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]Index: Rendering/vtkAssembly.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkAssembly.cxx,v
retrieving revision 1.57
diff -u -r1.57 vtkAssembly.cxx
--- Rendering/vtkAssembly.cxx 4 Jan 2005 20:56:39 -0000 1.57
+++ Rendering/vtkAssembly.cxx 28 Feb 2007 15:26:18 -0000
@@ -311,35 +317,39 @@
prop3D = (vtkProp3D *)path->GetLastNode()->GetViewProp();
if ( prop3D->GetVisibility() )
{
- propVisible = 1;
prop3D->PokeMatrix(path->GetLastNode()->GetMatrix());
bounds = prop3D->GetBounds();
prop3D->PokeMatrix(NULL);
- // fill out vertices of a bounding box
- bbox[ 0] = bounds[1]; bbox[ 1] = bounds[3]; bbox[ 2] = bounds[5];
- bbox[ 3] = bounds[1]; bbox[ 4] = bounds[2]; bbox[ 5] = bounds[5];
- bbox[ 6] = bounds[0]; bbox[ 7] = bounds[2]; bbox[ 8] = bounds[5];
- bbox[ 9] = bounds[0]; bbox[10] = bounds[3]; bbox[11] = bounds[5];
- bbox[12] = bounds[1]; bbox[13] = bounds[3]; bbox[14] = bounds[4];
- bbox[15] = bounds[1]; bbox[16] = bounds[2]; bbox[17] = bounds[4];
- bbox[18] = bounds[0]; bbox[19] = bounds[2]; bbox[20] = bounds[4];
- bbox[21] = bounds[0]; bbox[22] = bounds[3]; bbox[23] = bounds[4];
-
- for (i = 0; i < 8; i++)
+ if (bounds)
{
- for (n = 0; n < 3; n++)
+ propVisible = 1;
+
+ // fill out vertices of a bounding box
+ bbox[ 0] = bounds[1]; bbox[ 1] = bounds[3]; bbox[ 2] = bounds[5];
+ bbox[ 3] = bounds[1]; bbox[ 4] = bounds[2]; bbox[ 5] = bounds[5];
+ bbox[ 6] = bounds[0]; bbox[ 7] = bounds[2]; bbox[ 8] = bounds[5];
+ bbox[ 9] = bounds[0]; bbox[10] = bounds[3]; bbox[11] = bounds[5];
+ bbox[12] = bounds[1]; bbox[13] = bounds[3]; bbox[14] = bounds[4];
+ bbox[15] = bounds[1]; bbox[16] = bounds[2]; bbox[17] = bounds[4];
+ bbox[18] = bounds[0]; bbox[19] = bounds[2]; bbox[20] = bounds[4];
+ bbox[21] = bounds[0]; bbox[22] = bounds[3]; bbox[23] = bounds[4];
+
+ for (i = 0; i < 8; i++)
{
- if (bbox[i*3+n] < this->Bounds[n*2])
- {
- this->Bounds[n*2] = bbox[i*3+n];
- }
- if (bbox[i*3+n] > this->Bounds[n*2+1])
+ for (n = 0; n < 3; n++)
{
- this->Bounds[n*2+1] = bbox[i*3+n];
- }
- }//for each coordinate axis
- }//for each point of box
+ if (bbox[i*3+n] < this->Bounds[n*2])
+ {
+ this->Bounds[n*2] = bbox[i*3+n];
+ }
+ if (bbox[i*3+n] > this->Bounds[n*2+1])
+ {
+ this->Bounds[n*2+1] = bbox[i*3+n];
+ }
+ }//for each coordinate axis
+ }//for each point of box
+ }//if bounds
}//if visible && prop3d
}//for each path
|
|