<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 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 the window "Press any key to continue" and then nothing. Do you know what I should do?<BR>
Thanks in advance.<BR>
<BR>
<BR>
#include "vtkVectors.h"<BR>#include "vtkFloatVectors.h"<BR>#include "vtkIdList.h"<BR>#include "vtkMath.h"<BR>
vtkVectors::vtkVectors()<BR>{<BR> this->MaxNorm = 0.0;<BR>}<BR>
void vtkVectors::GetVector(int id, float v[3])<BR>{<BR> float *vp = this->GetVector(id);<BR> for (int i=0; i<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> float v[3];<BR>
v[0] = vx;<BR> v[1] = vy;<BR> v[2] = vz;<BR> this->InsertVector(id,v);<BR>}<BR>
// Description:<BR>// Insert vector into position indicated.<BR>int vtkVectors::InsertNextVector(float vx, float vy, float vz)<BR>{<BR> float v[3];<BR>
v[0] = vx;<BR> v[1] = vy;<BR> v[2] = vz;<BR> return this->InsertNextVector(v);<BR>}<BR>
// Description:<BR>// Given a list of pt ids, return an array of vectors.<BR>void vtkVectors::GetVectors(vtkIdList& ptId, vtkFloatVectors& fp)<BR>{<BR> for (int i=0; i<ptId.GetNumberOfIds(); i++)<BR> {<BR> fp.InsertVector(i,this->GetVector(ptId.GetId(i)));<BR> }<BR>}<BR>
// Description:<BR>// Compute the largest norm for these vectors.<BR>void vtkVectors::ComputeMaxNorm()<BR>{<BR> int i;<BR> float *v, norm;<BR>
if ( this->GetMTime() > this->ComputeTime )<BR> {<BR> this->MaxNorm = 0.0;<BR> for (i=0; i<this->GetNumberOfVectors(); i++)<BR> {<BR> v = this->GetVector(i);<BR> norm = vtkMath::Norm(v);<BR> if ( norm > this->MaxNorm ) this->MaxNorm = norm;<BR> }<BR>
this->ComputeTime.Modified();<BR> }<BR>}<BR>
// Description:<BR>// Return the maximum norm for these vectors.<BR>float vtkVectors::GetMaxNorm()<BR>{<BR> this->ComputeMaxNorm();<BR> return this->MaxNorm;<BR>}<BR>
void vtkVectors::PrintSelf(ostream& os, vtkIndent indent)<BR>{<BR> vtkReferenceCount::PrintSelf(os,indent);<BR>
os << indent << "Number Of Vectors: " << this->GetNumberOfVectors() << "\n";<BR> os << indent << "Maximum Euclidean Norm: " << this->GetMaxNorm() << "\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>