[vtkusers] wxPython and Linux?

Harris Scott R CIV AFRL/SNJM Scott.Harris at wpafb.af.mil
Wed Jul 19 14:59:15 EDT 2000


What's the current status on a renderwidget for wxPython and Linux?
I know that there is a working version for windows, but I want to develop on Linux.

Thanks for the help!
-Scott


Scott Harris, Ph.D.                           
AFRL/SNJM BLDG 622
3109 P Street
WPAFB OH 45433-7700

scott.harris at wpafb.af.mil
937/255-9614x285 (Office)
937/255-9614x284 (Lab)
937255-6489         (Fax)     


-----Original Message-----
From: Ron Inbar [mailto:ron at eun.co.il]
Sent: Wednesday, July 19, 2000 1:27 PM
To: Nigel Nunn; vtkusers at public.kitware.com
Subject: [vtkusers] Re: Using cell colors with point normals


Hi Nigel,

I did some probing into the vtkPolyDataMapper code and I found the answer:
the mapper behaves as desired if the following condition holds:

input->GetPointData()->GetNormals() != 0 &&
interpolation != VTK_FLAT &&
input->GetCellData()->GetNormals() == 0 &&
(this->ScalarMode == VTK_SCALAR_MODE_USE_CELL_DATA ||
input->GetPointData()->GetScalars() == 0)

What this means is that you need to have point normals and cell scalars (of
course), but no cell normals.  So after you generate all the necessary data
(don't forget to update the mapper's input), just write:

mapper->GetInput()->GetCellData()->SetNormals(0);

and either

mapper->GetInput()->GetPointData()->SetScalars(0);

or more simply

mapper->SetScalarModeToUseCellData();

and off you go.

Hope this helps.

Ron


----- Original Message -----
From: Nigel Nunn <nNunn at ausport.gov.au>
To: <vtkusers at public.kitware.com>
Cc: <ron at eun.co.il>
Sent: éåí øáéòé 19 éåìé 2000 17:34
Subject: Re: Using cell colors with point normals


>
> To:  Ron Inbar [ron at eun.co.il]]
> Re:  Using cell colors with point normals.
> Was: Getting vtkPolyDataRenderer to use both
>      cell data and point data.
>
> Hi Ron,
> I just faced a similar problem.
> Here is a first pass at a solution.
> Nigel.
>
>
> file://------------------------------------------------
> void CPANLDoc::UseCellValuesToColorPointData()
> file://------------------------------------------------
>

>
>   // Choose how to display the results.
>
>   if (m_bColorByPanelForces)
>     m_panelMapper->SetScalarModeToUseCellData();
>   else
>     m_panelMapper->SetScalarModeToUsePointData();
>
>
>   vtkUnstructuredGrid* pGrid = m_pVtkData->GetPanelGrid();
>   vtkVectors *cellVecs = pGrid->GetCellData()->GetVectors();
>   vtkScalars *cellData = pGrid->GetCellData()->GetScalars();
>   vtkScalars *nodeData = pGrid->GetPointData()->GetScalars();
>
>   file://-------------------------------------
>   // First, update data for each CELL.
>   file://-------------------------------------
>
>   double vec[3];
>
>   for (i=1; i<=m_nPanels; ++i)
>

>     vec[0] = (float) m_FXPi(i,1);
>     vec[1] = (float) m_FYPi(i,1);
>     vec[2] = (float) m_FZPi(i,1);
>
>     cellVecs->SetVector(i-1, vec);
>   file://cellData->SetScalar(i-1, 20 * m_FXPi(i,1));
>   file://cellData->SetScalar(i-1, 10 * m_FYPi(i,1));
>     cellData->SetScalar(i-1, 10 * m_FZPi(i,1));
>   }
>
>
>   file://-------------------------------------
>   // Now update data for each NODE.
>   // (Allocating values for the PointData
>   // by averaging over cell values.)
>   file://-------------------------------------
>
>   const int MAX_IDS_IN_CELL = 4;
>
>   int idc, nIDs;
>   double val=0.0;
>
>   vtkIdList *cellIds = vtkIdList::New();
>   cellIds->Allocate(MAX_IDS_IN_CELL);
>
>   for (i=0; i<m_nNodes; ++i)
>

>     // Get list of CELLS that use this NODE
>     pGrid->GetPointCells(i, cellIds);
>
>     nIDs = cellIds->GetNumberOfIds();
>     val=0.0;
>     for (int j=0; j < nIDs; ++j)
>

>       idc = cellIds->GetId(j);
>       val += cellData->GetScalar(idc);
>     }
>
>     val /= nIDs;
>
>     nodeData->SetScalar(i, val);
>   }
>
>
>   m_pVtkData->GetPanelGrid()->Modified();
>
>   // Adjust colors in LookupTable
>   m_pVtkData->BuildLookupTable();
>
>   this->UpdateAllViews(NULL,0,0);
>
> }
>
>
>


_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers




More information about the vtkusers mailing list