[vtkusers] VtkUnstructuredGrid display

Scott J. Pearson scottjp at CLEMSON.EDU
Tue Feb 1 14:43:59 EST 2005


I'm using vtkUnstructuredGrid to display mathematical data - the results of
calculations along a 2-D mesh for a fiber-producing die. VTK serves me quite
well with this. However, the other day, I discovered that they X scale is
reversed on my display: Positive X values are on the left and negative X
values are on the left! (The Y axis acts normally.)

I could simply reverse camera angles, but this would also invert the numbers
along my axes. A newbie at filtering, I've tried to filter the data via a
vtkTransformFilter, but the data disappears when I call it.

Any advice on what I should do? A potion of my code is attached below.

Scott


    gridreader_ = vtkUnstructuredGridReader::New();
    gridreader_->SetFileName(filename_.ansi_c_str()); //"fiber1d.vtk");
    gridreader_->SetTensorsName("stress");
    ugrid_ = gridreader_->GetOutput();

    ugrid_->Update();

    invert_ = vtkGeneralTransform::New();
    invert_->Identity();
    invert_->Scale(-1.0, 0.0, 0.0);

    transformFilter_ = vtkTransformFilter::New();
    transformFilter_->SetTransform(invert_);
    transformFilter_->SetInput(ugrid_);

    // Defaults for scalmapper
    scalmapper_ = vtkDataSetMapper::New();
//    scalmapper_->SetInput(transformFilter_->GetOutput());
    scalmapper_->SetInput(ugrid_);

    actor_ = vtkActor::New();
    actor_->SetMapper(scalmapper_);

    renderer_->AddActor(actor_);


---
Scott J. Pearson
Systems Programmer, Center for the Advanced Engineering of Fibers and Films
Clemson University     864.656.6389     scottjp at clemson.edu
10 Riggs Hall, Clemson, SC  29634
http://www.clemson.edu/caeff/





More information about the vtkusers mailing list