答复: 答复: [vtkusers] the adjacent vertex

PAUL polinzhuo at 163.com
Thu Jan 4 07:53:18 EST 2007


     vtkCubeSource *pCube = vtkCubeSource::New();

     pCube->SetCenter(0,0,0);

     pCube->SetXLength(2);

     pCube->SetYLength(2);

     pCube->SetZLength(2);

     vtkPolyData *data = pCube->GetOutput();

     data->Update();

     int i;

     int cellCount = data->GetNumberOfCells();

     int pointCount = data->GetNumberOfPoints();

     vtkIdList *ptsIDList = vtkIdList::New();

     ptsIDList->Allocate(pointCount);

     for (i=0;i<pointCount;i++) {

         ptsIDList->InsertNextId(i);

     }

 

         vtkIdList *CurrentcellPts = vtkIdList::New();

         data->GetCellPoints(0,CurrentcellPts);

 

         vtkIdType ptIdinCurrentCell = CurrentcellPts->GetId(0);

         

         vtkIdList *cellIDList = vtkIdList::New();

         data->GetCellNeighbors(i,ptsIDList,cellIDList);

         int ptscount = ptsIDList->GetNumberOfIds();

         int cellcount = cellIDList->GetNumberOfIds();

 

cellcount whould be the number of cells which is adjacent to 0 cell.But
cellcount is 0. why?

 

 

-----邮件原件-----
发件人: Dominik Szczerba [mailto:domi at vision.ee.ethz.ch] 
发送时间: 2007年1月4日 18:48
收件人: vtkusers at vtk.org
抄送: PAUL
主题: Re: 答复: [vtkusers] the adjacent vertex

 

On a second thought the below will not capture all the connected points

directly, only at a cell. But you can achieve what you want by combining

it with GetCellNeighbours.

Another way is to first walk the cells maping them to their points (e,g.

using std::map) and then walk the points retreiving the cells and their

points. Rejecting duplicates you get what you are after.

-DS

 

Dominik Szczerba wrote:

> You can locate the cell containing the point of interest and call

> GetCellPoints().

> DS

> 

> PAUL wrote:

>> Hello all:

>> 

>> I have been baffled the question for a long time.

>> 

>> I am studying an algorithm of judging convex or non-convex polyhedron.

>> 

>> If  every  vertex  is above the plane which contain three vertexes

>> adjacent to the vertex, the polyhedron is convex .

>> 

>> For an example, there are eight vertexes on a cube. And each vertex is

>> adjacent to three other vertexes.

>> 

>> My question is:

>> 

>> When an arbitrary vertex is accessed, how to know the other three

>> vertexes’ coordinate?

>> 

>>  

>> 

>> I need your helps! Thank you!!

>> 

>>  

>> 

>>  

>> 

>> ------------------------------------------------------------------------

>> 

>> *发件人:* vtkusers-bounces+polinzhuo=163.com at vtk.org

>> [mailto:vtkusers-bounces+polinzhuo=163.com at vtk.org] *代表 *PAUL

>> *发送时间:* 2007年1月4日 13:44

>> *收件人:* vtkusers at vtk.org

>> *主题:* [vtkusers] the adjacent vertex

>> 

>>  

>> 

>> Hi,all:

>> 

>> There is an arbitrary vertex on a polyhedron. How to find the other

>> three vertexes which are adjacent to the vertex?

>> 

>> Paul

>> 

>>  

>> 

>> 

>> ------------------------------------------------------------------------

>> 

>> _______________________________________________

>> This is the private VTK discussion list. 

>> Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ

>> Follow this link to subscribe/unsubscribe:

>> http://www.vtk.org/mailman/listinfo/vtkusers

> _______________________________________________

> This is the private VTK discussion list. 

> Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ

> Follow this link to subscribe/unsubscribe:

> http://www.vtk.org/mailman/listinfo/vtkusers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070104/37f93cb5/attachment.htm>


More information about the vtkusers mailing list