[vtkusers] Unwanted point data averaging !!! How to stop it?

Davood Ansari david.ansari at gmail.com
Thu Mar 27 14:34:40 EDT 2014


Hi every one

I am visualizing some surface integral equation solution in VTK using
unstructured grid.
The color/scalars are associated with points but since I  do not want
to have any averaging between adjacent polygons I assign duplicate points (
and scalars )
in my unstructured grid. Despite that, I see clear averaging between the
scalars near the
common edges. How can I stop that ???
Attached is the simplified code

Thanks in advance



void arrayIEFFT::arrayIEFFT::visFaces(vtkUnstructuredGrid* faceGrid,
vtkPoints* facePoints)
{
  pointMap myPointMap;
  myPointMap.clear();

  std::vector<myReal> visScalarsTmp;
  std::vector<char> visScalarsTmpCounter;
  VTK_CREATE(vtkDoubleArray, visScalars) ;// This shall contain the scalar
data
  visScalars->SetName("_visScalars") ;
  visScalars->SetNumberOfComponents(1);


  VTK_CREATE(vtkDoubleArray, visVector) ;// This shall contain the vector
field plot data
  visVector->SetNumberOfComponents(3) ;
  visVector->SetName("_visVector");


  int faceGridPointCounter = 0;
  VTK_CREATE(vtkIdList, facePointIds);
  facePointIds->Allocate(9);
  facePointIds->SetNumberOfIds(9);
  .
  .
  .
  .

  faceGrid->SetPoints(facePoints);
  faceGrid->GetPointData()->SetScalars(visScalars);
  faceGrid->GetPointData()->AddArray(visVector) ;

  std::cout << "\nTotal number of visulization nodess: " <<
 faceGrid->GetNumberOfPoints();
  std::cout << "\nTotal number of visulized cells: " <<  cellCount;
  std::cout.flush();
}

void arrayIEFFT::arrayIEFFT::visualize()
{
    VTK_CREATE(vtkUnstructuredGrid, faceGrid);
    VTK_CREATE(vtkPoints, facePoints);

    visFaces(vtkUnstructuredGrid* faceGrid, vtkPoints* facePoints)

    VTK_CREATE(vtkDataSetMapper,faceMapper);
    faceMapper->SetInput(faceGrid);
    faceMapper->SetScalarVisibility(1);


    vtkActor *faceActor = vtkActor::New();
    faceActor->SetMapper( faceMapper );
    faceActor->GetProperty()->SetOpacity(1.);

    vtkRenderer *rederer= vtkRenderer::New();
    rederer->AddActor( faceActor );

    vtkCamera* cam = rederer->GetActiveCamera();
    cam->SetPosition(myConf.cameraPosition[0], myConf.cameraPosition[1],
myConf.cameraPosition[2]);
    cam->SetFocalPoint(myConf.camFocalX,myConf.camFocalY,myConf.camFocalZ);

    vtkRenderWindow *renWin = vtkRenderWindow::New();
    renWin->AddRenderer( rederer );
    renWin->SetSize( myConf.winX, myConf.winY );
    //renWin->SetOffScreenRendering(1.);
    renWin->SetWindowName(strm.c_str());
    vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    renWin->Start();
    renWin->Render();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140327/4a3b617b/attachment.html>


More information about the vtkusers mailing list