[vtkusers] Re: vtkWarpTo
Amy Henderson
amy.henderson at kitware.com
Tue Mar 18 11:34:11 EST 2003
Hi Marisa,
The points in VTK have an associated point id. You can get the points for
your data set by calling
mypoly->GetPoints();. You can also get the coordinates of each point, and
you can use this information to determine the point ids of the points you
want to warp. (See the online man page for vtkPoints for more details:
http://www.vtk.org/doc/nightly/html/classvtkPoints.html)
You can create an instance of vtkFloatArray to contain a normal vector per
point. (The ids of the points and the ids of the normals should
match.) Once you've filled in this array, you can call
mypoly->GetPointData()->SetNormals(normals);.
- Amy
PS Please keep this type of discussion on the vtkusers list so everyone
benefits from the discussion (and there are more people to help answer your
question).
At 04:20 PM 3/18/2003 +0000, you wrote:
>Hi Amy
>Thanks for you help. But I still don't know how to do it.
>When you say "... you already have to specify a vector per point in
>your input data." what do you meen??? How do I do that???
>My code is like this:
>
>int main( int argc, char *argv[] )
>{
> vtkSuperquadricSource *Superquadric = vtkSuperquadricSource::New();
> Superquadric->SetThetaResolution( 100.0 );
> Superquadric->SetPhiResolution( 100.0 );
> Superquadric->SetPhiRoundness( 1 );
> Superquadric->SetThetaRoundness(1);
> Superquadric->SetScale(0.65,1,0.65);
>
> vtkPolyData *mypoly = Superquadric->GetOutput();
> Superquadric->Update();
>
> vtkWarpVector *warp = vtkWarpVector::New();
> warp->SetInput(mypoly);
> warp->SetScaleFactor(0.2);
>
> vtkPolyDataMapper *ClipMapper = vtkPolyDataMapper::New();
> ClipMapper->SetInput(warp->GetPolyDataOutput());
>
> vtkActor *SuperquadricActor = vtkActor::New();
> SuperquadricActor->SetMapper( ClipMapper );
>
> vtkRenderer *ren1= vtkRenderer::New();
> ren1->AddActor( SuperquadricActor );
> ren1->SetBackground( 0.1, 0.2, 0.4 );
>
> vtkRenderWindow *renWin = vtkRenderWindow::New();
> renWin->AddRenderer( ren1 );
> renWin->SetSize( 1024, 960 );
>
> vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
> iren->SetRenderWindow(renWin);
> iren->Initialize();
> iren->Start();
> int i;
> for (i = 0; i < 3060; ++i)
> {
> // render the image
> renWin->Render();
> }
>
> SuperquadricActor->Delete();
> renWin->Delete();
> return 0;
>}
>
>And also, how do I specify the points where I want to use a 'null'
>vector?? How do I say that in that point I want to user that vector?? How
>do I specify each point???
>Thanks for your help...
>Marisa
>
>_________________________________________________________________
>The new MSN 8: smart spam protection and 2 months FREE*
>http://join.msn.com/?page=features/junkmail
More information about the vtkusers
mailing list