[vtkusers] Pbs with Streamlines.
Guillen Antonio
tonio.guillen at gmail.com
Wed Aug 16 14:15:06 EDT 2017
I try to build streamline using this code:
vtkPoints points = new vtkPoints();
points.SetDataTypeToDouble();
double sizeMaxField = aValue;
vtkDoubleArray vector3DArray = new vtkDoubleArray();
vector3DArray.SetNumberOfComponents(3);
vector3DArray.SetName("Vector");
for (int i = 0; i < grid.getCellNumber(); i++) {
Vector3D fieldValue = (Vector3D) getValue(i);
Point3D p = (Point3D) grid.getCellBarycenter(i);
points.InsertNextPoint(p.x, p.y, p.z);
vector3DArray.InsertNextTuple3(fieldValue.x, fieldValue.y,
fieldValue.z);
}
vtkPolyData polyData = new vtkPolyData();
polyData.SetPoints(points);
polyData.GetPointData().SetVectors(vector3DArray);
// Create the source points for the streamlines
vtkPointSource pointSource = new vtkPointSource();
Point3D center = Point3D.barycenter(grid.getOrigin(),
grid.getExtremalPoint());
pointSource.SetCenter(center.x, center.y, center.z);
pointSource.SetRadius(grid.getExtremalPoint().distance(grid.getOrigin())/2.);
pointSource.SetDistributionToUniform();
pointSource.SetNumberOfPoints(1500);
pointSource.Update();
tracer = new vtkStreamTracer();
tracer.SetSourceData(polyData);
tracer.SetSourceConnection(pointSource.GetOutputPort());
tracer.SetMaximumPropagation(100);
tracer.SetInitialIntegrationStep(1);
tracer.SetIntegrationDirectionToForward();
tracer.SetComputeVorticity(false);
tracer.SetIntegrator(new vtkRungeKutta4());
tracer.Update();
streamTube = new vtkRibbonFilter();
streamTube.SetInputConnection(tracer.GetOutputPort());
streamTube.SetWidth(5);
streamTube.SetWidthFactor(5);
streamTube.Update();
mapper = new vtkPolyDataMapper();
mapper.SetInputConnection(streamTube.GetOutputPort());
I don't see nothing!!!! Some body can help me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170816/f4ed0a4a/attachment.html>
More information about the vtkusers
mailing list