+// -------------------------------------------------------------------------
+void cpPlugins::Extensions::Visualization::ImageInteractorStyle::
+_UpdateRadius( )
+{
+ vtkRenderer* ren =
+ this->Interactor->GetRenderWindow( )->
+ GetRenderers( )->GetFirstRenderer( );
+ if( ren == NULL )
+ return;
+ vtkCamera* cam = ren->GetActiveCamera( );
+ if( cam == NULL )
+ return;
+
+ if( this->RadiusMoving )
+ {
+ double x = this->Cursor[ 0 ] - this->Radius[ 0 ];
+ double y = this->Cursor[ 1 ] - this->Radius[ 1 ];
+ double z = this->Cursor[ 2 ] - this->Radius[ 2 ];
+ double r = std::sqrt( ( x * x ) + ( y * y ) + ( z * z ) );
+
+ vtkMatrix4x4* cam_matrix = cam->GetModelViewTransformMatrix( );
+ vtkSmartPointer< vtkMatrix4x4 > circle_matrix =
+ this->CircleActor->GetUserMatrix( );
+ if( circle_matrix.GetPointer( ) == NULL )
+ {
+ circle_matrix = vtkSmartPointer< vtkMatrix4x4 >::New( );
+ this->CircleActor->SetUserMatrix( circle_matrix );
+
+ } // fi
+ for( int i = 0; i < 4; ++i )
+ {
+ for( int j = 0; j < 4; ++j )
+ {
+ double v = cam_matrix->GetElement( i, j );
+ if( i < 3 && j == 3 )
+ v = this->Cursor[ i ];
+ if( i < 3 && j < 3 )
+ v *= r;
+ circle_matrix->SetElement( i, j, v );
+
+ } // rof
+
+ } // rof
+ this->CircleActor->Modified( );
+ ren->AddActor( this->CircleActor );
+ }
+ else
+ ren->RemoveActor( this->CircleActor );
+
+ this->Interactor->Render( );
+}
+