[vtkusers] interactively updating a cuttin plane
Dr. A. M. Zsaki
zsaki at encs.concordia.ca
Mon Mar 6 13:18:30 EST 2006
Hello,
I have a structured grid dataset that I visualize by setting up a cutting
plane. What I'm after is being able to manipulate (I know of 3D widgets, but
I want something else)
the orientation and origin of the cutting plane. My code does the following
so far:
if (fRotateAngle==360.0) {
fRotateAngle=0.0;
}
float fXDirVector=cos(fRotateAngle*0.0174528); // *PI/180.0 ... could get
away buy premultiplying and storing this constant...
float fYDirVector=sin(fRotateAngle*0.0174528); // *PI/180.0
fRotateAngle+=1.0;
// cutting plane
vtkPlane *xyPlane=vtkPlane::New();
xyPlane->SetOrigin(fOriginCell[0],fOriginCell[1],fOriginCell[2]);
xyPlane->SetNormal(fXDirVector,0,fYDirVector);
vtkCutter* xyCutter=vtkCutter::New();
xyCutter->SetInput(readerResults->GetOutput());
xyCutter->SetCutFunction(xyPlane);
// cutting plane
// solid filled cutting plane
vtkPolyDataMapper *contourMapper1=vtkPolyDataMapper::New();
contourMapper1->SetInput(xyCutter->GetOutput());
contourMapper1->SetScalarRange(minmax[0],minmax[1]);
//
vtkActorCollection* actors=vtkActorCollection::New();
actors=ren->GetActors();
actors->InitTraversal();
int iNumberOfActors=actors->GetNumberOfItems();
if (iNumberOfActors>0) {
for (int i=0;i<iNumberOfActors;++i) {
vtkActor* actor=actors->GetNextActor();
if (actorVector.IsRightType(actor,5)) {
actor->SetMapper(contourMapper1);
}
}
}
Basically it spins around the y axis a full circle. I works OK. However, is
there a more elegant way of reaching down to the 'xyPlane' from the 'actor'
(through its mapper) and changing its orientation and origin wihout incuring
the time cost of rebuilding this part of the visualization pipeline?
Thanks,
-------------------------
Dr. Attila M. Zsaki, Ph.D., P.Eng.
Assistant Professor
Building, Civil and Environmental Engineering
Concordia University
1455 de Maisonneuve Blvd, W., EV006.151
Montreal, QC H3G 1M8
T: 514-848-2424 x3198
F: 514-848-7965
zsaki at encs.concordia.ca
users.encs.concordia.ca/~zsaki
More information about the vtkusers
mailing list