<div>Hi,</div>
<div>&nbsp;</div>
<div>I&#39;m not that familiar with magnetic fields stuff so I&#39;ve re-worded the problem as follows (to the best that I could understand) and I&#39;ve also presented a solution:</div>
<div>&nbsp;</div>
<div>Let say we have&nbsp;the coordinates of a few points and we also have vectors (direction and magnitude) that emanate from each point. How do we visualize them?</div>
<div>&nbsp;</div>
<div>There are different ways of doing this. One would be using Glyph3D and ArrowSource in vtk but there is a trick to getting the magnitude of each arrow to be the magnitude of the each force vector. So I have not presented this approach. You can have a look at vtk documentation and examples to see how this works. The other way is to present the vectors as line segments whose length is equal to the force magnitude. 
</div>
<div>Here is how this is done:</div>
<div>&nbsp;</div>
<div>1) We create a poly data</div>
<div>2) Loop over the points and:</div>
<div>&nbsp;&nbsp;&nbsp; 2.1) add it to the poly data (this will the starting point of a line segment)</div>
<div>&nbsp;&nbsp;&nbsp; 2.2) compute the end point of the line segment (start point + force) and add it to the poly data</div>
<div>&nbsp;&nbsp;&nbsp; 2.3) add the line segment to the poly data that joins these two points</div>
<div>&nbsp;</div>
<div>Here is a partial C++ code:</div>
<div>&nbsp;</div>
<div>
<p><font face="courier new,monospace">int i; // used in a for-loop<br>int numPoints; // the number of points<br>double x[], y[], z[]; // x,y,z coordinate of the points<br>double vx[], vy[], vz[]; // the x,y,z coordinate of each vector
</font></p>
<p><font face="courier new,monospace">vtkPolyData *vecField = vtkPolyData::New();<br>vtkPoints *pnts = vtkPoints::New();</font></p>
<p><font face="courier new,monospace">vecField-&gt;SetPoints( pnts );<br>vecField-&gt;Allocate();<br>int numAddedPoints = 0;<br>for(i=0; i&lt;numPoints; i++)<br>{<br>&nbsp;&nbsp;&nbsp; double start[] = { x[i], y[i], z[i] };<br>&nbsp;&nbsp;&nbsp; double end[] = { x[i]+vx[i], y[i]+vy[i], z[i]+vz[i] };
<br>&nbsp;&nbsp;&nbsp; pnts-&gt;InsertNextPoint ( start );<br>&nbsp;&nbsp;&nbsp; pnts-&gt;InsertNextPoint ( end );</font></p>
<p><font face="courier new,monospace">&nbsp;&nbsp;&nbsp; int ids[] = { numAddedPoints, numAddedPoints+1 };<br>&nbsp;&nbsp;&nbsp; vecField-&gt;InsertNextCell( VTK_LINE, 2, ids );</font></p>
<p><font face="courier new,monospace">&nbsp;&nbsp;&nbsp; numAddedPoints += 2;<br>}<br>vecField-&gt;Squeeze();</font></p>All you need to do now is to use an actor to add&nbsp;the poly data&nbsp;to your scene and render it :)</div><br><br>
<div><span class="gmail_quote">On 8/17/07, <b class="gmail_sendername">yadin Bocuma Rivas</b> &lt;<a href="mailto:conra2004@yahoo.com">conra2004@yahoo.com</a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">hi!<br>i am planning to plot electromagnetic fiels using vtk<br>at the mooment i got the x,y,z coordinates into arrays and i have the magnitude
<br>or intensity of the fields ; that is at every point(x,y,z) i have the value of the corresponding&nbsp; component of the magnetic field in the x,y,z direction ; <br>how can i visualise this magnetidc field with vtk ;&nbsp; which commands can i use?
<br>i matlab I used quiver3(x,y,z,Ex,Ey,Ez) how can i do this with VTK <br><br>is an array of points(x,y,z) and the field is (Ex,Ey,Ez) please how can i start doing these<br><br>thanks <br><span class="ad">
<p>__________________________________________________<br>Correo Yahoo!<br>Espacio para todos tus mensajes, antivirus y antispam ¡gratis! <br>Regístrate ya - <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://correo.espanol.yahoo.com/" target="_blank">
http://correo.espanol.yahoo.com/</a> </p></span><br>_______________________________________________<br>This is the private VTK discussion list.<br>Please keep messages on-topic. Check the FAQ at: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>Follow this link to subscribe/unsubscribe:<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers
</a><br><br></blockquote></div><br>