[vtkusers] bounds of an actor

francesco caruso guernika_devel at yahoo.it
Thu Sep 16 13:08:54 EDT 2004


Hello
I'd like to know the bounds of an actor in a render window in display 
coordinate.

Can anybody of you tell me what's wrong in this piece of code?

      vtkCoordinate*	coord = vtkCoordinate::New();
      coord->SetCoordinateSystemToWorld();
      float* bounds;
      bounds = ghostCubeAct->GetBounds();
      int xmin = xsize;//xsize of the window
      int ymin = ysize;
      int xmax = 0;
      int ymax = 0;
      int x,y,z;
      int *point;
      for ( x=0; x<2; x++ )
  	    for ( y=2;y<4; y++ )
  		    for ( z=4; z<6; z++ ){
  			    coord->SetValue(bounds[x],bounds[y],bounds[z]);
  			    point = coord->GetComputedDisplayValue( ghostRenderer );
  			    if (xmin > point[0])
  				    xmin = point[0];
  			    if ( xmax < point[0] )
  				    xmax = point[0];
  			    if ( ymin > point[1] )
  				    ymin = point[1];
  			    if ( ymax < point[1] )
  				    ymax = point[1];
          		}


thanks in advance



More information about the vtkusers mailing list