[vtkusers] vtkPlaneWidget

James Robinson j.robinson at kepler-systems.com
Thu Aug 5 11:13:22 EDT 2004


Dear All,

 

Thanks to John (Biddiscombe) I am able to control my vtkCutter using the
vtkPlaneWidget. However, I also want to be able to do the reverse - i.e.
take the vtkPlane setup from the vtkCutter and apply them to the
vtkPlaneWidget (as I have already other menu driven controls to manipulate
the vtkPlane). My attempt at doing this is:

 

void CSampleDoc::UpdatePlaneWidget()

{

// This method is to update the plane widget from the vtkPlane used as the 

// implicit function for the vtkCutter

 

            vtkFloatingPointType normal[3] ;

            vtkFloatingPointType origin[3] ;

 

            pPlane->GetOrigin(origin) ;

            pPlane->GetNormal(normal) ;

CString message, dummy ;

message.Format("Origin:- x %lf, y %lf, z
%lf\n",origin[0],origin[1],origin[2]) ;

dummy.Format("Normal:- x %lf, y %lf, z %lf\n",normal[0],normal[1],normal[2])
;

message += dummy ;

AfxMessageBox(message) ;

           pPlaneWidget->SetOrigin(origin) ;

           pPlaneWidget->SetNormal(normal) ;

 

 

            pPlaneWidget->GetOrigin(origin) ;

            pPlaneWidget->GetNormal(normal) ;

message.Format("Origin:- x %lf, y %lf, z
%lf\n",origin[0],origin[1],origin[2]) ;

dummy.Format("Normal:- x %lf, y %lf, z %lf\n",normal[0],normal[1],normal[2])
;

message += dummy ;

AfxMessageBox(message) ;

 

 

}

This yields:

Origin: x 100.000000, y 100.0000000, z 10.0000000

Normal: x 0.000000, y 1.0000000, z 0.0000000

 

For the vtkPlane - which is what I have set up. 

 

However, the output from the vtkPlaneWidget is:

Origin: x 100.000000, y 10.0000000, z -100.0000000

Normal: x 0.000000, y 1.0000000, z 0.0000000

 

 

So the origin coordinates seem to have been mixed up. In addition, it
doesn't show the vtkPLaneWidget in this position (rather the normal is 1,0,0
and the origin (center??) seems alright??

 

Any advice would be appreciated.

 

Regards,

 

Jim

 

 

 

James C Robinson, PhD, Chartered Engineer,

*     42 Rivergrove,

         Glanmire,

         Co. Cork,

         Eire

'     +353 21 4822028

         +353 87 2393010

6      +353 21 4822028

*    j.robinson at kepler-systems.com 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040805/9da57b5a/attachment.htm>


More information about the vtkusers mailing list