<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Hi Michael.</DIV>
<DIV>I'm really sorry if i'm disturbing you but i didn't understand this very well.</DIV>
<DIV>In fact, i'm beginner in VTK developpment.</DIV>
<DIV>So can you explain me one more time what hould i do exactly?</DIV>
<DIV>Thanks a lot</DIV>
<DIV><BR><BR>--- En date de&nbsp;: <B>Lun 27.10.08, Michael Jackson <I>&lt;mike.jackson@bluequartz.net&gt;</I></B> a écrit&nbsp;:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">De: Michael Jackson &lt;mike.jackson@bluequartz.net&gt;<BR>Objet: Re: [vtkusers] What to use: 'vtkDataArray' or 'vtkDoubleArray'?<BR>À: butterfly.1688@yahoo.fr<BR>Cc: vtkusers@vtk.org<BR>Date: Lundi 27 Octobre 2008, 15h15<BR><BR><PRE>The values of the point are store in the pt variable which is really a  
array of 3 doubles.

x = pt[0], y = pt[1], z=pt[2]

If you are wanting to remove points from the polydata based on the  
value of their points being &lt; 0 or any individual point being &lt; 0 then  
I would suggest the vtkClipPolyData filter and write a quick custom  
vtkImplicitFunction to supply to that filter or look at using the  
vtkBox (Read the documentation carefully for vtkBox) as the  
implicitfunction.

_________________________________________________________
Mike Jackson                  mike.jackson@bluequartz.net
             www.bluequartz.net


On Oct 27, 2008, at 10:43 AM, B. C. wrote:

&gt; Thank you Michael for your help.
&gt; Can you tell me if i want to store the value of 'myArray- 
&gt; &gt;GetTuple(i,pt)' into a variable to make a test, waht type should i
 
&gt; use?
&gt;
&gt; In fact, i want to do this:
&gt; if (this_value&lt;0) : delete the point(i) of the ploydata
&gt;
&gt;
&gt; --- En date de : Lun 27.10.08, Michael Jackson
&lt;mike.jackson@bluequartz.net 
&gt; &gt; a écrit :
&gt; De: Michael Jackson &lt;mike.jackson@bluequartz.net&gt;
&gt; Objet: Re: [vtkusers] What to use: 'vtkDataArray' or
'vtkDoubleArray'?
&gt; À: butterfly.1688@yahoo.fr, vtkusers@vtk.org
&gt; Date: Lundi 27 Octobre 2008, 13h24
&gt;
&gt; vtkDoubleArray is a high level class that hides the actual array
&gt; implementation.
&gt;
&gt; What you probably want to do is this:
&gt; vtkDoubleArray* myArray=vtkDoubleArray::SafeDownCast(myPolyData-
&gt;  &gt;GetPoints());
&gt; if (NULL == myArray)
&gt; {
&gt;         Error ....
&gt; }
&gt; vtkIdType nPoints = myArray-&gt;GetNumberOfTuples();
&gt; double pt[3];
&gt; for (vtkIdType i = 0; i &lt; nPoints; ++i)
&gt; {
&gt;      myArray-&gt;GetTuple(i,pt);
&gt; // Do something with pt.
&gt; }
&gt;
&gt;
&gt; The above code is from memory but should be pretty close.
&gt;
&gt; If you really just want to access the data from the Data array then
&gt; you can do the following:
&gt;
&gt; vtkDoubleArray* myArray=vtkDoubleArray::SafeDownCast(myPolyData-
&gt;  &gt;GetPoints());
&gt; if (NULL == myArray)
&gt; {
&gt;     Error...
&gt; }
&gt; double* pts = static_cast&lt;double*&gt;(myArray-&gt;GetVoidPointer());
&gt;
&gt; That should get you a raw pointer to the data. So as long as you
&gt; understand the how the data is stored in that pointer you can iterate
&gt; over the pointer.
&gt;
&gt; _________________________________________________________
&gt; Mike Jackson                  mike.jackson@bluequartz.net
&gt; BlueQuartz Software                    www.bluequartz.net
&gt; Principal Software Engineer                  Dayton, Ohio
&gt;
&gt;
&gt;
&gt; On Oct 27, 2008, at 6:41 AM, B. C. wrote:
&gt;
&gt; &gt; Hi everyone.
&gt; &gt; I want to save the values of the points of a polydata in an array
&gt; &gt; and then access to each one. I used this:
&gt; &gt;
&gt; &gt; double curveValue;
&gt; &gt; vtkDoubleArray *myArray;
&gt; &gt; for (int i=0; i&lt;myPolydata-&gt;GetNumberOfPoints(); i++)
&gt; &gt; {
&gt; &gt;   myArray[i] = myPolyData-&gt;GetPoints()-&gt;GetPoint(i);
&gt; &gt;   curveValue = myArray-&gt;GetValue(i);
&gt; &gt; }
&gt; &gt;
&gt; &gt; I have this error:
&gt; &gt; binary '=' : no operator defined which takes a right-hand
operand
&gt; of
&gt; &gt; type 'double *'
&gt; &gt;
&gt; &gt; When i change the array type to 'vtkDataArray', i have this
code:
&gt; &gt; double *curveValue;
&gt; &gt; vtkDataArray *myArray = myPolyData-&gt;GetPoints()-&gt;GetData();
&gt; &gt; for (int i=0; i&lt;myPolyData-&gt;GetNumberOfPoints(); i++)
&gt; &gt; {
&gt; &gt;   curveValue = myArray-&gt;GetTuple(i);
&gt; &gt; }
&gt; &gt;
&gt; &gt; I have no more errors, but when i run the program, i have a bug and
&gt; &gt; the cursor indicates this line:
&gt; &gt; vtkDataArray *myArray = myPolyData-&gt;GetPoints()-&gt;GetData();
&gt; &gt;
&gt; &gt; I don't understand any one of the 2 error cases!!!
&gt; &gt; Please, can someone tell me what type of array should i use? and how
&gt; &gt; to rectify the code
&gt; &gt; to have no more errors?
&gt; &gt;
&gt; &gt; Thank you for you help
&gt; &gt;
&gt; &gt; _______________________________________________
&gt; &gt; This is the private VTK discussion list.
&gt; &gt; Please keep messages on-topic. Check the FAQ at:
&gt; http://www.vtk.org/Wiki/VTK_FAQ
&gt; &gt; Follow this link to subscribe/unsubscribe:
&gt; &gt; http://www.vtk.org/mailman/listinfo/vtkusers
&gt;
&gt;




</PRE></BLOCKQUOTE></td></tr></table><br>