Commit 16e07002 authored by Dan Lipsa's avatar Dan Lipsa Committed by Kitware Robot

Merge topic 'evenly-spaced-streamlines-bug'

0c374ee8 The computed seeds are changed slightly.
215e2b84 Fix bug when normals was nan. Add progress.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Scott Wittenburg's avatarScott Wittenburg <scott.wittenburg@kitware.com>
Merge-request: !4997
parents e87caa67 0c374ee8
f4b18c4101ca63c28f91dca600fc1fe92e91968db2aa58376f065574796815f087476d7d50fdb4e1f287d5370f2584305105172096710e45cf3641055c0e8576
29595a6dbd9d3fbbc5377d1a9ef404d2b44d41becf20022da1ba48061857aa221c4fe9486048afc079981a219dddbfcd73e43f1678822355bc4ef39b1bfa5db9
......@@ -189,16 +189,33 @@ int vtkEvenlySpacedStreamlines2D::RequestData(
const char* velocityName = this->GetInputArrayToProcessName();
double deltaOne = this->SeparatingDistanceArcLength / 1000;
double delta[3] = {deltaOne, deltaOne, deltaOne};
int maxNumberOfItems = 0;
float lastProgress = 0.0;
while (this->Streamlines->GetNumberOfItems())
{
int numberOfItems = this->Streamlines->GetNumberOfItems();
if (numberOfItems > maxNumberOfItems)
{
maxNumberOfItems = numberOfItems;
}
if (processedSeedId % 10 == 0)
{
float progress = (static_cast<float>(maxNumberOfItems) - numberOfItems) / maxNumberOfItems;
if (progress > lastProgress)
{
this->UpdateProgress(progress);
lastProgress = progress;
}
}
streamline = vtkPolyData::SafeDownCast(this->Streamlines->GetItemAsObject(0));
vtkDataArray* normals = streamline->GetPointData()->GetArray("Normals");
vtkDataArray* velocity = streamline->GetPointData()->GetArray(velocityName);
for (vtkIdType pointId = 0; pointId < streamline->GetNumberOfPoints(); ++pointId)
{
// generate 2 new seeds for every streamline point
double newSeedVector[3];
vtkMath::Cross(normals->GetTuple(pointId), velocity->GetTuple(pointId),
double normal[3] = {0, 0, 1};
vtkMath::Cross(normal, velocity->GetTuple(pointId),
newSeedVector);
// floating point errors move newSeedVector out of XY plane.
newSeedVector[2] = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment