No subject

Wei.Shao at waii.com Wei.Shao at waii.com
Wed Jul 21 12:55:33 EDT 1999


Hi folks:

In one of my application, I want to modify the point positions in a
vtkPolyData. I found out the following two piece of codes gave me the same
effect. In Code A: I extracted the vtkPoints from the vtkPolyData and reset
the value of a given point through vtkPoints. In Code B: I copy the
vtkPoints of vtkPolyData to a new vtkPoints, and set the new vtkPoints to
the vtkPolyData. Code A looks much simpler than Code B.

However the vtkPointPicker is not working any more when I used the Code A.
This really puzzled me. Please tell me the reason If someone know why.

Wei Shao


Code A:
              vtkPolyData *m_pSelectedObject;
              .............................
     vtkPoints  *pPts =  m_pSelectedObject->GetPoints();

     float *p;
               ..........  // get p
               pPts->InsertPoint(0, p);
              m_pSelectedObject->Modified();


Code B:
     vtkPoints  *pPts =  m_pSelectedObject->GetPoints();


     float *p;

     vtkPoints *pNewPts = vtkPoints::New();
     int numPts = pPts->GetNumberOfPoints();
     pNewPts->Allocate(numPts, numPts);
     for(int i =0 ; i< numPts; i++)
     {
               p=pPts->GetPoint(i);
               if(i == 0)
               {
                    p = //get p from some where
               }
               pNewPts->InsertNextPoint(p);
     }

     m_pSelectedObject->SetPoints(pNewPts);
     m_pSelectedObject->Modified();
     pNewPts->Delete();








-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list