<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
Hi everyone,<BR>
I am&nbsp; trying to learn how to use vtk. I tried a sample code found in the book "The Visualisation Toolkit" for displaying vectors. The code is the following. I included all header files. When I run it there are no errors. However the only thing I see is&nbsp;the window "Press any key to continue" and then nothing. Do you know what I should do?<BR>
Thanks in advance.<BR>
&nbsp;<BR>
&nbsp;<BR>
#include "vtkVectors.h"<BR>#include "vtkFloatVectors.h"<BR>#include "vtkIdList.h"<BR>#include "vtkMath.h"<BR>
vtkVectors::vtkVectors()<BR>{<BR>&nbsp; this-&gt;MaxNorm = 0.0;<BR>}<BR>
void vtkVectors::GetVector(int id, float v[3])<BR>{<BR>&nbsp; float *vp = this-&gt;GetVector(id);<BR>&nbsp; for (int i=0; i&lt;3; i++) v[i] = vp[i];<BR>}<BR>
// Description:<BR>// Insert vector into position indicated.<BR>void vtkVectors::InsertVector(int id, float vx, float vy, float vz)<BR>{<BR>&nbsp; float v[3];<BR>
&nbsp; v[0] = vx;<BR>&nbsp; v[1] = vy;<BR>&nbsp; v[2] = vz;<BR>&nbsp; this-&gt;InsertVector(id,v);<BR>}<BR>
// Description:<BR>// Insert vector into position indicated.<BR>int vtkVectors::InsertNextVector(float vx, float vy, float vz)<BR>{<BR>&nbsp; float v[3];<BR>
&nbsp; v[0] = vx;<BR>&nbsp; v[1] = vy;<BR>&nbsp; v[2] = vz;<BR>&nbsp; return this-&gt;InsertNextVector(v);<BR>}<BR>
// Description:<BR>// Given a list of pt ids, return an array of vectors.<BR>void vtkVectors::GetVectors(vtkIdList&amp; ptId, vtkFloatVectors&amp; fp)<BR>{<BR>&nbsp; for (int i=0; i&lt;ptId.GetNumberOfIds(); i++)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; fp.InsertVector(i,this-&gt;GetVector(ptId.GetId(i)));<BR>&nbsp;&nbsp;&nbsp; }<BR>}<BR>
// Description:<BR>// Compute the largest norm for these vectors.<BR>void vtkVectors::ComputeMaxNorm()<BR>{<BR>&nbsp; int i;<BR>&nbsp; float *v, norm;<BR>
&nbsp; if ( this-&gt;GetMTime() &gt; this-&gt;ComputeTime )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; this-&gt;MaxNorm = 0.0;<BR>&nbsp;&nbsp;&nbsp; for (i=0; i&lt;this-&gt;GetNumberOfVectors(); i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; v = this-&gt;GetVector(i);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; norm = vtkMath::Norm(v);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( norm &gt; this-&gt;MaxNorm ) this-&gt;MaxNorm = norm;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>
&nbsp;&nbsp;&nbsp; this-&gt;ComputeTime.Modified();<BR>&nbsp;&nbsp;&nbsp; }<BR>}<BR>
// Description:<BR>// Return the maximum norm for these vectors.<BR>float vtkVectors::GetMaxNorm()<BR>{<BR>&nbsp; this-&gt;ComputeMaxNorm();<BR>&nbsp; return this-&gt;MaxNorm;<BR>}<BR>
void vtkVectors::PrintSelf(ostream&amp; os, vtkIndent indent)<BR>{<BR>&nbsp; vtkReferenceCount::PrintSelf(os,indent);<BR>
&nbsp; os &lt;&lt; indent &lt;&lt; "Number Of Vectors: " &lt;&lt; this-&gt;GetNumberOfVectors() &lt;&lt; "\n";<BR>&nbsp; os &lt;&lt; indent &lt;&lt; "Maximum Euclidean Norm: " &lt;&lt; this-&gt;GetMaxNorm() &lt;&lt; "\n";<BR>}<BR><BR><br /><hr />Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! <a href='http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us' target='_new'>Try it!</a></body>
</html>