Hugo,<div><br></div><div>I can&#39;t see anything wrong with your code, but like Jim said, I don&#39;t know what kind of surface you are trying to create.  Just try adding this:</div><div><br></div><div>Actor.GetProperty().SetAmbient(1.0);</div>

<div><br></div><div>Depending on the lighting, sometimes surfaces can be so dark you cannot see them.  By setting ambient lighting to 1.0, you make all surfaces appear bright regardless of the light position or the surface orientation.</div>

<div><br></div><div>  David</div><div><br></div><div><br><div class="gmail_quote">On Thu, Nov 25, 2010 at 9:05 AM, Jim Peterson <span dir="ltr">&lt;<a href="mailto:jimcp@cox.net">jimcp@cox.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
          //set ids<br>
          for (int i = 0; i &lt; nx - 1; i++)<br>
          {<br>
              *cells.InsertNextCell(ny * 2);*<br>
              for (int j = 0; j &lt; ny; j++)<br>
             {<br>
                *cells.InsertCellPoint(i + j * nx);*<br></div>
                *cells.InsertCellPoint(i + j * nx + 1);*<br>
             }<br>
          }<br>
</blockquote>
I suggest you add a comment with the expected result and comment the lines, Unless I am mistaken, you are created sets of overlapping cells, at a minimum, I would expect the numbering to be i*nx instead of j*nx. that would result in sequential cell definitions.<br>


<br>
Hope that helps,<br>
Jim<br>
<br>
Hugo,<br>
<br>
What kind of topology are you expecting this loop to create?<br>
<br>
<br>
Hugo Valdebenito wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
Hi David, thanks for your useful help!<br>
<br>
I tried with you suddestion, but didn&#39;t get it work :(. please, can you check my code?<br>
<br>
      public void* GenerateTest*(int nx, int ny)<br>
       {<br>
<br>
          vtkPoints points = vtkPoints.New();<br>
          vtkCellArray cells = new vtkCellArray();<br>
               //vtkTriangleStrip triangleStrip;<br>
<br>
          int index = 0;<br>
          double z,zmax = 50.0;<br>
          points.SetNumberOfPoints(nx * ny);<br>
          for (int j = 0; j &lt; ny; j++)<br>
          {<br>
             for (int i = 0; i &lt; nx; i++)<br>
             {<br>
                z = zmax * Math.Sin(4 * 3.1 * i / (float)nx) + 4 * j / (float)(ny);<br>
                //insert point and increment index<br>
                points.SetPoint(index++,(double)i, (double)j, (double)z);<br>
             }<br>
          }<br>
          //set ids<br>
          for (int i = 0; i &lt; nx - 1; i++)<br>
          {<br>
              *cells.InsertNextCell(ny * 2);*<br>
              for (int j = 0; j &lt; ny; j++)<br>
             {<br>
                *cells.InsertCellPoint(i + j * nx);*<br>
                *cells.InsertCellPoint(i + j * nx + 1);*<br>
             }<br>
          }<br>
          vtkPolyData polydata = new vtkPolyData();<br>
          polydata.SetPoints(points);<br>
          polydata.SetStrips(cells);<br>
                 // Create an actor and mapper<br>
          vtkDataSetMapper mapper = new vtkDataSetMapper();<br>
          mapper.SetInput(polydata);<br>
          vtkActor Actor = new vtkActor();<br>
                   Actor.SetMapper(mapper);<br>
          Actor.GetProperty().SetRepresentationToWireframe();<br>
          //Add the actors to the scene<br>
          _renderer.AddActor(Actor);<br>
<br>
<br>
Hugo.<br>
<br></div></div>
2010/11/23 David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a> &lt;mailto:<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt;&gt;<div class="im">

<br>
<br>
    Hi Hugo,<br>
<br>
    Go with my method.  Remove the vtkTriangleStrip class from your<br>
    code, it isn&#39;t needed and it just makes the code less efficient<br>
    (and IMHO more confusing).  The vtkCellArray has many<br>
    InsertNextCell methods, and the one that takes a vtkCell object is<br>
    the least efficient of all of them.  For you, I think the best way<br>
    to add cells is this:<br>
<br>
    cells.InsertNextCell(number_of_ids_in_strip)<br>
    cells.InsertCellPoint(first_id_in_strip)<br>
    cells.InsertCellPoint(second_id_in_srip)<br>
    (repeat InsertCellPoint for all IDs)<br>
<br>
    Repeat all of the above for each strip that you want to add, then<br>
    call SetStrips() to add the whole cell array to the<br>
    polydata.  Look at the example code that I linked to in my<br>
    previous email for more info.<br>
<br>
      David<br>
<br>
<br>
    On Tue, Nov 23, 2010 at 4:30 AM, Hugo Valdebenito &lt;<a href="mailto:hugo@maptek.cl" target="_blank">hugo@maptek.cl</a><br></div><div class="im">
    &lt;mailto:<a href="mailto:hugo@maptek.cl" target="_blank">hugo@maptek.cl</a>&gt;&gt; wrote:<br>
<br>
        Hi David.<br>
<br>
        Thanks for you help, I&#39;m trying to undestand, I have some<br>
        doubts yet,  Which is the difference between both methods?         Wich is better?.<br>
<br>
        Hugo. <br>
<br>
        2010/11/22 David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a><br></div>
        &lt;mailto:<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt;&gt;<div class="im"><br>
<br>
            Hi Hugo,<br>
<br>
            Your code is a mix of the method that I suggested and the<br>
            method that David Doria suggested.  The SetStrips() method<br>
            is a low-level method for building a vtkPolyData (as per<br>
            my suggestion).  The InsertNextCell() method is a<br>
            high-level method for building a vtkDataSet (as per David<br>
            Doria&#39;s suggestion).  You have to use one method or the<br>
            other, not both.  I apologize for the confusion.<br>
<br>
              David<br>
<br>
            On Mon, Nov 22, 2010 at 11:10 AM, Hugo Valdebenito<br></div><div><div></div><div class="h5">
            &lt;<a href="mailto:hugo@maptek.cl" target="_blank">hugo@maptek.cl</a> &lt;mailto:<a href="mailto:hugo@maptek.cl" target="_blank">hugo@maptek.cl</a>&gt;&gt; wrote:<br>
<br>
                Hi David.<br>
<br>
                It works with one strip, but that doesn&#39;t work with 2<br>
                o more strips. that is my implementation (sorry,  is<br>
                C#, I translated the c++ example)<br>
<br>
                       public void GenerateSurface(int nx, int ny)<br>
                       {<br>
<br>
                          vtkPoints points = vtkPoints.New();<br>
                          vtkCellArray cells = new vtkCellArray();<br>
                          vtkTriangleStrip triangleStrip;<br>
<br>
<br>
                          double z,zmax = 50.0;<br>
                          points.SetNumberOfPoints(nx * ny);<br>
                         //se points<br>
                          int index = 0;<br>
                          for (int j = 0; j &lt; ny; j++)<br>
                          {<br>
                             for (int i = 0; i &lt; nx; i++)<br>
                             {<br>
                                z = zmax * Math.Sin(4 * 3.1 * i /<br>
                (float)nx) + 4 * j / (float)(ny);<br>
                                //insert point and increment index<br>
                                *points.SetPoint(index++,(double)i,<br>
                (double)j, (double)z);*<br>
<br>
<br>
                             }<br>
                          }<br>
                          //set ids<br>
                          for (int i = 0; i &lt; nx - 1; i++)<br>
                          {<br>
                             index = 0;<br>
                             triangleStrip = new vtkTriangleStrip();<br>
                                            triangleStrip.GetPointIds().SetNumberOfIds(ny*2);<br>
<br>
                              for (int j = 0; j &lt; ny; j++)<br>
                             {<br>
                                               triangleStrip.GetPointIds().SetId(index++, i + j * nx);<br>
                                               triangleStrip.GetPointIds().SetId(index++, i + j * nx<br>
                + 1);<br>
                             }<br>
                             *cells.InsertNextCell(triangleStrip);*<br>
                          }<br>
                          vtkPolyData polydata = new vtkPolyData();<br>
                          polydata.SetPoints(points);<br>
                          *polydata.SetStrips(cells);*<br>
                                               // Create an actor and mapper<br>
                          vtkDataSetMapper mapper = new<br>
                vtkDataSetMapper();<br>
                          mapper.SetInput(polydata);<br>
                          vtkActor Actor = new vtkActor();<br>
                                                   Actor.SetMapper(mapper);<br>
                                         Actor.GetProperty().SetRepresentationToWireframe();<br>
                          //Add the actors to the scene<br>
                          _renderer.AddActor(Actor);<br>
                     }<br>
<br>
<br>
                Hugo<br>
<br>
<br>
<br>
                2010/11/22 David Gobbi &lt;<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a><br></div></div>
                &lt;mailto:<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>&gt;&gt;<div class="im"><br>
<br>
                    Hi Hugo,<br>
<br>
                    The vtkPolyData stores the strips in an array<br>
                    called &quot;Strips&quot;, that is<br>
                    how it knows what cells are strips.  And all<br>
                    vtkDataSet objects have a<br>
                    GetCellType(i) method that VTK can use to check<br>
                    the type of cell &quot;i&quot;.<br>
                    I have some code here that generates several<br>
                    shapes with triangle<br>
                    strips:<br>
                    <a href="https://github.com/dgobbi/ToolCursor/blob/master/vtkGeometricCursorShapes.cxx" target="_blank">https://github.com/dgobbi/ToolCursor/blob/master/vtkGeometricCursorShapes.cxx</a><br>
<br>
                     David<br>
<br>
<br>
                    On Mon, Nov 22, 2010 at 5:55 AM, Hugo Valdebenito<br></div><div class="im">
                    &lt;<a href="mailto:hugo@maptek.cl" target="_blank">hugo@maptek.cl</a> &lt;mailto:<a href="mailto:hugo@maptek.cl" target="_blank">hugo@maptek.cl</a>&gt;&gt; wrote:<br>
                    &gt;<br>
                    &gt; You should to see the triangles, maybe it&#39;s<br>
                    wrong. with 4 ids you define 2<br>
                    &gt; triagles, with 5 --&gt; 3 and so on (that structure<br>
                    saves memory). How does you<br>
                    &gt; said to vtk that you are using Strips?  I don&#39;t<br>
                    know how to define that on<br>
                    &gt; VTK.<br>
                    &gt;<br>
                    &gt;<br>
                    &gt; Thanks!<br>
                    &gt;<br>
                    &gt;<br>
                    &gt;<br>
                    &gt; 2010/11/19 David Doria &lt;<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a><br></div>
                    &lt;mailto:<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>&gt;&gt;<div class="im"><br>
                    &gt;&gt;<br>
                    &gt;&gt; On Fri, Nov 19, 2010 at 3:22 PM, Hugo<br>
                    Valdebenito &lt;<a href="mailto:hugo@maptek.cl" target="_blank">hugo@maptek.cl</a><br></div><div class="im">
                    &lt;mailto:<a href="mailto:hugo@maptek.cl" target="_blank">hugo@maptek.cl</a>&gt;&gt; wrote:<br>
                    &gt;&gt; &gt; Thanks david!!<br>
                    &gt;&gt; &gt;<br>
                    &gt;&gt; &gt; vtkCellArray object is defined, but never<br>
                    used....<br>
                    &gt;&gt; &gt;<br>
                    &gt;&gt; &gt; Anyone can suggest a fix?, I&#39;m beginner on VTK<br>
                    &gt;&gt; &gt; Hugo<br>
                    &gt;&gt;<br>
                    &gt;&gt; Try it now. It doesn&#39;t show the line through<br>
                    the middle of the square<br>
                    &gt;&gt; (the center edge of the triangles), but maybe<br>
                    that is expected with a<br>
                    &gt;&gt; triangle strip?<br>
                    &gt;&gt;<br>
                    &gt;&gt;<br>
                    &gt;&gt;<br>
                    <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Broken/GeometricObjects/TriangleStrip" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Broken/GeometricObjects/TriangleStrip</a><br>
                    &gt;&gt;<br>
                    &gt;&gt; David<br>
<br>
<br>
<br>
<br>
<br>
<br></div>
------------------------------------------------------------------------<div class="im"><br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
  <br>
</div></blockquote>
<br>
</blockquote></div><br></div>