[vtkusers] Default initial plane when using vtkPlaneWidget?
Xiaopeng Yang
yxp233 at postech.ac.kr
Tue Nov 22 11:20:01 EST 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111123/2d11391c/attachment.htm>
More information about the vtkusers
mailing list