[vtkusers] how to iterate over extracted edges?

lynx.abraxas at freenet.de lynx.abraxas at freenet.de
Thu Jan 14 16:14:49 EST 2010


On 12/01/10 14:55:11, David Doria wrote:
> It may be helpful in cases like this for some of the experienced
> members to give a "not that I've seen/heard of" type of response. A
> few negative responses from some experienced members can be very
> useful to decide if he should go ahead and write something himself.
> What I'm imagining is happening if people don't know the answer, they
> are just not responding in hopes that someone else will know the
> answer and respond. However, sometimes the answer is "no one knows the
> answer/ such a filter does not exist" and this can be inferred by a
> few "I don't knows".
>

So  I'm  stuck  again:  I  want  to  iterate  over  the edges of the output of
vtkDelaunay3D. I triede the following code but it never  reports  any  angles.
Why's that? It seems there's no GetNextCell() ever.

Thanks for any help or hints.
Lynx
_________________________________________


        vtkExtractEdges *edges= vtkExtractEdges::New();
        edges->SetInputConnection(delaunay3D->GetOutputPort());
        
        //vtkCellArray *lines= delaunay3D->GetOutput()->GetLines(); //does this work as well?
        vtkCellArray *lines= edges->GetOutput()->GetLines();
        vtkPoints *epoints = edges->GetOutput()->GetPoints();

        //unsigned int num_e= lines->GetNumberOfCells();
        
        cout << "Computing angles... " << endl;        
        double angle;
//         for(int i= 0; i << num_e; i++){
//             angle= vtkMath::Dot(vtkMath::Normalize(lines->Get),
//             }

        vtkIdType npts, *pts;
        double p0[3], p1[3];

        lines->InitTraversal();
        while(lines->GetNextCell(npts, pts)){
            if (npts != 2){
                cout << "Didn't get two points! Skipping edge!" << endl;
                continue;
                }
            epoints->GetPoint(pts[0], p0); 
            epoints->GetPoint(pts[1], p1);
            vtkMath::Normalize(p0);
            vtkMath::Normalize(p1);
            angle= acos(vtkMath::Dot(p0, p1)) * 180.0 / PI;
            cout << angle << "; ";
            }
        cout << endl;




More information about the vtkusers mailing list