? build
? build_debug
? vtkPropPickerPatch
Index: Rendering/vtkAbstractPicker.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkAbstractPicker.cxx,v
retrieving revision 1.11
diff -u -p -r1.11 vtkAbstractPicker.cxx
--- Rendering/vtkAbstractPicker.cxx	21 Nov 2003 16:42:32 -0000	1.11
+++ Rendering/vtkAbstractPicker.cxx	25 May 2008 20:00:58 -0000
@@ -15,6 +15,7 @@
 #include "vtkAbstractPicker.h"
 
 #include "vtkObjectFactory.h"
+#include "vtkCamera.h"
 #include "vtkRenderer.h"
 
 vtkCxxRevisionMacro(vtkAbstractPicker, "$Revision: 1.11 $");
@@ -77,6 +78,56 @@ void vtkAbstractPicker::DeletePickList(v
   this->PickList->RemoveItem(a);
 }
 
+// calculate and set PickPosition (world-space) based on the given
+// selection point (screen space with depth coord) and the current
+// renderer (this->Renderer)
+void vtkAbstractPicker::CalculatePickPosition(double selectionPoint[3]){
+  
+  double cameraFP[4];
+  double display[3], *world;
+  double *displayCoord;
+
+  for(int i=0;i<3;i++)
+    {
+    this->SelectionPoint[i] = selectionPoint[i];
+    }
+
+  // if z is 1.0, we assume the user has picked a point on the
+  // screen that has not been rendered into. Use the camera's focal
+  // point for the z value. The test value .999999 has to be used
+  // instead of 1.0 because for some reason our SGI Infinite Reality
+  // engine won't return a 1.0 from the zbuffer
+  if (selectionPoint[2] >= 0.999999)
+    {
+    // Get camera focal point and position. Convert to display (screen) 
+    // coordinates. We need a depth value for z-buffer.
+    vtkCamera *camera = this->Renderer->GetActiveCamera();
+    camera->GetFocalPoint(cameraFP); cameraFP[3] = 1.0;
+      
+    this->Renderer->SetWorldPoint(cameraFP[0],cameraFP[1],cameraFP[2],cameraFP[3]);
+    this->Renderer->WorldToDisplay();
+    displayCoord = this->Renderer->GetDisplayPoint();
+    this->SelectionPoint[2] = displayCoord[2];
+    vtkDebugMacro(<< "computed z from focal point: " << selectionPoint[2]);
+    }
+  else
+    {
+    vtkDebugMacro(<< " z from zBuffer: " << selectionPoint[2]);
+    }
+  
+  // now convert the display point to world coordinates
+
+  this->Renderer->SetDisplayPoint (this->SelectionPoint);
+  this->Renderer->DisplayToWorld ();
+  world = this->Renderer->GetWorldPoint ();
+  
+  for (int i=0; i < 3; i++) 
+    {
+    this->PickPosition[i] = world[i] / world[3];
+    }
+
+}
+
 void vtkAbstractPicker::PrintSelf(ostream& os, vtkIndent indent)
 {
   this->Superclass::PrintSelf(os,indent);
Index: Rendering/vtkAbstractPicker.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkAbstractPicker.h,v
retrieving revision 1.14
diff -u -p -r1.14 vtkAbstractPicker.h
--- Rendering/vtkAbstractPicker.h	5 Dec 2003 18:19:59 -0000	1.14
+++ Rendering/vtkAbstractPicker.h	25 May 2008 20:00:58 -0000
@@ -124,6 +124,8 @@ protected:
 
   virtual void Initialize();
 
+  void CalculatePickPosition(double selectionPoint[3]);
+
   vtkRenderer *Renderer; //pick occurred in this renderer's viewport
   double SelectionPoint[3]; //selection point in window (pixel) coordinates
   double PickPosition[3]; //selection point in world coordinates
Index: Rendering/vtkPropPicker.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkPropPicker.cxx,v
retrieving revision 1.26
diff -u -p -r1.26 vtkPropPicker.cxx
--- Rendering/vtkPropPicker.cxx	21 Feb 2006 18:35:50 -0000	1.26
+++ Rendering/vtkPropPicker.cxx	25 May 2008 20:00:58 -0000
@@ -91,8 +91,8 @@ int vtkPropPicker::PickProp(double selec
   // its pick method.
   if ( this->Path )
     {
-    this->WorldPointPicker->Pick(selectionX, selectionY, 0, renderer);
-    this->WorldPointPicker->GetPickPosition(this->PickPosition);
+    this->SelectionPoint[2] = renderer->GetPickedZ();
+    this->CalculatePickPosition(this->SelectionPoint);
     this->Path->GetLastNode()->GetViewProp()->Pick();
     this->InvokeEvent(vtkCommand::PickEvent,NULL);
     } 
Index: Rendering/vtkWorldPointPicker.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Rendering/vtkWorldPointPicker.cxx,v
retrieving revision 1.22
diff -u -p -r1.22 vtkWorldPointPicker.cxx
--- Rendering/vtkWorldPointPicker.cxx	23 Feb 2008 17:18:46 -0000	1.22
+++ Rendering/vtkWorldPointPicker.cxx	25 May 2008 20:00:58 -0000
@@ -31,62 +31,22 @@ vtkWorldPointPicker::vtkWorldPointPicker
 int vtkWorldPointPicker::Pick(double selectionX, double selectionY, 
                               double selectionZ, vtkRenderer *renderer)
 {
-  vtkCamera *camera;
-  double cameraFP[4];
-  double display[3], *world;
-  double *displayCoord;
-  double z;
+  double selectionPoint[3];
 
   // Initialize the picking process
   this->Initialize();
   this->Renderer = renderer;
-  this->SelectionPoint[0] = selectionX;
-  this->SelectionPoint[1] = selectionY;
-  this->SelectionPoint[2] = selectionZ;
 
   // Invoke start pick method if defined
   this->InvokeEvent(vtkCommand::StartPickEvent,NULL);
 
-  z = renderer->GetZ (static_cast<int>(selectionX),
-                      static_cast<int>(selectionY));
-  
-  // if z is 1.0, we assume the user has picked a point on the
-  // screen that has not been rendered into. Use the camera's focal
-  // point for the z value. The test value .999999 has to be used
-  // instead of 1.0 because for some reason our SGI Infinite Reality
-  // engine won't return a 1.0 from the zbuffer
-  if (z < 0.999999)
-    {
-    selectionZ = z;
-    vtkDebugMacro(<< " z from zBuffer: " << selectionZ);
-    }
-  else
-    {
-    // Get camera focal point and position. Convert to display (screen) 
-    // coordinates. We need a depth value for z-buffer.
-    camera = renderer->GetActiveCamera();
-    camera->GetFocalPoint(cameraFP); cameraFP[3] = 1.0;
-
-    renderer->SetWorldPoint(cameraFP[0],cameraFP[1],cameraFP[2],cameraFP[3]);
-    renderer->WorldToDisplay();
-    displayCoord = renderer->GetDisplayPoint();
-    selectionZ = displayCoord[2];
-    vtkDebugMacro(<< "computed z from focal point: " << selectionZ);
-    }
-
-  // now convert the display point to world coordinates
-  display[0] = selectionX;
-  display[1] = selectionY;
-  display[2] = selectionZ;
-
-  renderer->SetDisplayPoint (display);
-  renderer->DisplayToWorld ();
-  world = renderer->GetWorldPoint ();
-  
-  for (int i=0; i < 3; i++) 
-    {
-    this->PickPosition[i] = world[i] / world[3];
-    }
+  selectionPoint[0] = selectionX;
+  selectionPoint[1] = selectionY;
+  selectionPoint[2] = renderer->GetZ (static_cast<int>(selectionX),
+				      static_cast<int>(selectionY));
+
+  // sets PickPosition var
+  this->CalculatePickPosition(selectionPoint);
 
   // Invoke end pick method if defined
   this->InvokeEvent(vtkCommand::EndPickEvent,NULL);
