[vtkusers] Default initial plane when using vtkPlaneWidget?

Alex Malyushytskyy alexmalvtk at gmail.com
Tue Nov 22 17:25:25 EST 2011


As far as I understand you never set plane orientation for widget:

1.You create instance of the plane
2.You set plane orientation and origin
3. you create plane widget with default orientation and position
4 you override with theses defaults, values you set  in 2.

plane widget orientation and position never were changed

Now what to do ( I never tried this class so everything below is just
as the way I seeit ) :

First of all
       planeWidget->GetPlane(this->Plane);

// never change anything in plane widget
// all it does update plane (object pointer to which you pass to
function )with  orientation  and position


read  http://www.vtk.org/doc/nightly/html/classvtkPlaneWidget.html#details

........
   planeWidget->PlaceWidget();

// add after line above
   planeWidget->SetNormal ( n )l;
   planeWidget->SetOrigin(p1);
......................


On Tue, Nov 22, 2011 at 8:27 AM, Xiaopeng Yang <yxp233 at postech.ac.kr> wrote:
> Sorry, I mean the initial plane of the vtkPlaneWidget, not the initial plan.
>
>
>
> From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
> Of Xiaopeng Yang
> Sent: Wednesday, November 23, 2011 1:20 AM
> To: 'vtk'
> Subject: [vtkusers] Default initial plane when using vtkPlaneWidget?
>
>
>
> Dear All,
>
>
>
> How are you doing?
>
> When using vtkPlaneWidget, no matter how I define the plane, the initial
> plan of the vtkPlaneWidget does not change at all. I used three points to
> generate the plane and change the plane by changing the locations of the
> three points. Here is my code:
>
>
>
> class vtkTIPWCallback : public vtkCommand
>
> {
>
> public:
>
>   static vtkTIPWCallback *New()
>
>     { return new vtkTIPWCallback; }
>
>   virtual void Execute(vtkObject *caller, unsigned long, void*)
>
>     {
>
>       //vtkImplicitPlaneWidget *planeWidget =
>
>       //  reinterpret_cast<vtkImplicitPlaneWidget*>(caller);
>
>          vtkPlaneWidget *planeWidget =
>
>         reinterpret_cast<vtkPlaneWidget*>(caller);
>
>       planeWidget->GetPlane(this->Plane);
>
>       }
>
> }
>
>
>
> int main (int argc, char *argv[])
>
> {
>
>          vtkPlane *plane = vtkPlane::New();
>
>
>
>          double n[3];
>
>
>
>          double p1[3] = {-27.929, -136.901, 821.344};
>
>          double p2[3] = {-86.1809, -166.647, 777.784};
>
>          double p3[3] = {-117.166, -183.999, 733.234};
>
>
>
>          vtkTriangle::ComputeNormal(p1,p2,p3,n);
>
>
>
>          plane->SetNormal(n[0],n[1],n[2]);
>
>
>
>          plane->SetOrigin(p1[0], p1[1], p1[2]);
>
>
>
>          vtkTIPWCallback *myCallback = vtkTIPWCallback::New();
>
>          myCallback->Plane = plane;
>
>          myCallback->Actor = selectActor;
>
>
>
>          vtkPlaneWidget *planeWidget = vtkPlaneWidget::New();
>
>          planeWidget->SetInteractor(iren_SP);
>
>          planeWidget->SetPlaceFactor(1.0);
>
>          planeWidget->SetHandleSize(0.01);
>
>
>
>          planeWidget->SetInput(iso_Liver->GetOutput());
>
>          planeWidget->PlaceWidget();
>
>          planeWidget->SetRepresentationToSurface();
>
>          planeWidget->GetPlaneProperty()->SetColor(0.4,0.8,0.9);
>
>          planeWidget->GetPlaneProperty()->SetOpacity(0.5);
>
>          planeWidget->GetPlane(plane);
>
>
>
>          planeWidget->AddObserver(vtkCommand::InteractionEvent,myCallback);
>
>
>
>          …
>
> }
>
>
>
> Thank you very much,
>
> Xiaopeng
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list