[vtkusers] help
ghzhao
ghzhao at comgi.com
Fri Sep 21 23:56:26 EDT 2001
I write a class vtkKnittedFabricSource, but it does not work.
When I move the Execut() method outside just like the CSpline.tcl demo, it works. Why?
void vtkKnittedFabricSource::Execute()
{
float pi= 3.141592654;
int i, numPts;
float x, y, z, s;
vtkPoints *newPoints;
vtkCellArray *newPolys;
vtkTubeFilter *profileTubes;
vtkPolyData *profileData = vtkPolyData::New();
vtkPolyData *polyData = vtkPolyData::New();
//
// Set things up; allocate memory
//
numPts = this->ThetaResolution;
newPoints = vtkPoints::New();
newPoints->Allocate(numPts);
newPolys = vtkCellArray::New();
newPolys->InsertNextCell(numPts);
//
// Generate points and lines
//
for(i=0; i<numPts; i++)
{
s=1.0*i/numPts;
x = this->Shape*s*s*s-1.5*this->Shape*s*s+(this->Width+this->Shape)*s/2;
y = 0.5*(this->Height+this->Overlap)*(1-cos(pi*s));
z = 0.5*(this->Thickness-2*this->Radius)*(1-cos(2*pi*s));
newPoints->InsertPoint(i, x, y, z);
newPolys->InsertCellPoint(i);
}
profileData->SetPoints( newPoints);
profileData->SetLines( newPolys);
profileTubes =vtkTubeFilter::New();
profileTubes->SetNumberOfSides(this->PhiResolution);
profileTubes->SetInput( profileData);
profileTubes->SetRadius( this->Radius);
//
// Update ourselves and release memory
//
this->SetOutput(profileTubes->GetOutput());
// newPoints->Delete();
// newPolys->Delete();
// profileTubes->Delete();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010922/ab145079/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkKnittedFabricSource.cxx
Type: application/octet-stream
Size: 7349 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010922/ab145079/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtkKnittedFabricSource.h
Type: application/octet-stream
Size: 5689 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010922/ab145079/attachment-0001.obj>
More information about the vtkusers
mailing list