[vtkusers] Point data averaging !!! How to stop it?
Davood Ansari
david.ansari at gmail.com
Tue Apr 1 17:40:48 EDT 2014
Hi all
I am reseeding this email in the hope that some one knows some thing.
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();
}
On Thu, Mar 27, 2014 at 2:34 PM, Davood Ansari <david.ansari at gmail.com>wrote:
> 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();
> }
>
>
>
>
>
--
Davood Ansari O.B.
Research Scientist
Computational Electromagnetics and Photonics Lab
Department of Electrical and Computer Engineering
Northeastern University
Email: dansari at ece.neu.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140401/3c4f2d02/attachment.html>
More information about the vtkusers
mailing list