[vtk-developers] Major problem in vtkRenderer.h

Lisa Avila lisa.avila at kitware.com
Tue Sep 10 10:35:00 EDT 2002


Hello,

Even if this could work on the Mac it should not be in VTK. Since we can't 
change the fact that VTK returns pointers to arrays (although getting rid 
of that would be great!) one solution is to add a method something like this:

float GetVisibilePropBound( int index )
{
   float bounds[6];
   this->ComputeVisiblePropBounds(bounds);

   if ( index >= 0 && index <6 )
     {
     return bounds[index];
     }
   else
     {
     vtkErrorMacro("Bad index: " << index << " . Should be 0 to 5" );
     return 0.0;
     }
}

This method does not require any additional class storage, and is safe 
across multiple instances of a vtkRenderer even when running simultaneously 
in different threads. Probably the next best solution would be the one Andy 
suggested - create an ivar to store the returned value.  static variable 
should be avoided at all costs.

Lisa


At 09:47 AM 9/10/2002, Andy Cedilnik wrote:
>Hello,
>
>Last night somebody added this to vtkRenderer.h. We need to get rid of
>this, since it does not work on Mac:
>
>   // Description:
>   // Wrapper-friendly version of ComputeVisiblePropBounds
>   float *ComputeVisiblePropBounds()
>     {
>     static float bounds[6];
>     this->ComputeVisiblePropBounds(bounds);
>     return bounds;};
>
>If there is another way, please use it. For example, create a member
>variable, and then do this:
>
>   float *ComputeVisiblePropBounds()
>     {
>     this->ComputeVisiblePropBounds(this->ComputedVisibleBounds);
>     return this->ComputedVisibleBounds;};
>
>                         Andy
>
>
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtk-developers




More information about the vtk-developers mailing list