[vtkusers] RE: Coloring one single point

Nigel Nunn nNunn at ausport.gov.au
Fri Jun 28 09:51:22 EDT 2002


Hi Giancarlo, 
You need to associate a scalar value with each point (or cell). 
Before Vtk 4.x, this was done by assigning a vtkScalars object 
as the point (cell) data in your grid.  In Vtk 4.x, use one of 
the vtk[Int/Float/Double]Array classes, and set this array as 
the grid's point (or cell) data.  Try something like this: 
 
  // CellData
  m_bdryCellBC = vtkIntArray::New(); 
    m_bdryCellBC->SetNumberOfComponents(1);
 
  // PointData 
  m_bdryPointBC = vtkIntArray::New(); 
    m_bdryPointBC->SetNumberOfComponents(1);
 
  m_bdryGrid = vtkUnstructuredGrid::New(); 
    m_bdryGrid->Allocate(); 
    m_bdryGrid->SetPoints(m_pPoints); 
 
    // Map boundary markers to element (cell) faces 
   (m_bdryGrid->GetCellData())->SetScalars(m_bdryCellBC); 

    // Map boundary markers to nodes 
   (m_bdryGrid->GetPointData())->SetScalars(m_bdryPointBC); 
 
Later, 
 
  m_bdryPointBC->InsertNextValue( oldval ); 
 
Later still, 
 
  m_bdryPointBC->SetValue( pd->GetPoint(ID), newval ); 
 
Nigel  
 
------- Giancarlo Amati wrote ------- 
> I have a polydata structure and I would like to color 
> one and only one point with a different color.  with 
> pd->GetPoint(ID) I obtain my point, can I change it's 
> color?


**********************************************************************
This message is intended for the addressee named and may contain 
confidential and privileged information. If you are not the intended 
recipient please note that any form of distribution, copying or use of 
this communication or the information in it is strictly prohibited and 
may be unlawful. If you receive this message in error, please delete it 
and notify the sender.

Keep up to date with what's happening in Australian sport.
Visit http://www.ausport.gov.au
**********************************************************************



More information about the vtkusers mailing list