Pointers in wrapped VTK code

Help
2008-04-08
2013-04-25
  • Sarah  Macumber

    Sarah Macumber - 2008-04-08

    Hi, some member functions take pointers as arguments like vtkPointSet's method SetPoints :

    virtual void     SetPoints (vtkPoints *)

    However, C# doesn't do pointers so the following code errors,

    vtkPoints p = new vtkPoints();
    vtkPointSet pts = new vtkPointSet();
    pts.SetPoints(p);

    Could not downcast pointer to native class.

    Help?

     
    • Alex

      Alex - 2008-04-28

      You need to insert points to vtkPoints before you call SetPoints()

      Working example:

      vtkPoints points = new vtkPoints();
      for (int z = 0; z < vecs.Length; z++)
      {
         points.InsertPoint(z, vecs[z].ToDouble());
      }

      vtkPolyData pd = new vtkPolyData();
      pd.SetPoints(points);
      pd.SetPolys(cells);

      vecs - array of Vectors(My class)

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks