# Unexpected behavior of MaxStepDistance in TemporalParticlesToPathlines

**URL:** https://discourse.paraview.org/t/unexpected-behavior-of-maxstepdistance-in-temporalparticlestopathlines/17643
**Category:** ParaView Support
**Created:** [June 30, 2026, 4:09pm UTC](https://discourse.paraview.org/t/unexpected-behavior-of-maxstepdistance-in-temporalparticlestopathlines/17643 "2026-06-30T16:09:25Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![anahitanaj](https://discourse.paraview.org/user_avatar/discourse.paraview.org/anahitanaj/32/17746_2.png) [@anahitanaj](https://discourse.paraview.org/u/anahitanaj)
#### Post date: [June 30, 2026, 4:09pm UTC](https://discourse.paraview.org/t/unexpected-behavior-of-maxstepdistance-in-temporalparticlestopathlines/17643/1 "2026-06-30T16:09:25Z")

</div>

Hi everyone,

I am using **ParticleTracer** followed by **TemporalParticlesToPathlines** in ParaView 6.0 to visualize the pathlines in the blood vessels of the body using 4D flow MRI data.

I use:

_ForceReinjectionEveryNSteps = 1  
a custom unique PathlineParticleId (combining ParticleId and InjectionStepId) as the IdChannelArray  
MaskPoints = 2  
MaxTrackLength = 3_

I initially expected a lower **MaxStepDistance** to remove unrealistic long jumps between particle positions, based on the documentation:

> “If a step occurs larger than the value, the track will be dropped and restarted after the step.”

However, I observe the opposite behavior.

In my example dataset, with **MaxStepDistance** = 20, many straight “bad stitch” lines appear across the vessel (see image below).

 ![bad_stitching](https://discourse.paraview.org/uploads/default/original/3X/d/e/de8b6a190fed17caa15fc526545f142d99cb29ba.jpeg)

Increasing **MaxStepDistance** to 50 removes these artifacts and produces smooth pathlines:

 ![badstitchfixed](https://discourse.paraview.org/uploads/default/original/3X/3/a/3a5a97c1f307f7a203b7a7cf287678beb8532598.jpeg)

I verified that my custom IDs are unique, so this does not appear to be an ID problem.

My question is:

How is **MaxStepDistance** actually applied inside **TemporalParticlesToPathlines**? Specifically, why would decreasing the threshold counterintuitively create straight stitching artifacts, whereas increasing it removes them? Any insight into the implementation or intended behavior would be greatly appreciated.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 6, 2026, 4:08pm UTC](https://discourse.paraview.org/t/unexpected-behavior-of-maxstepdistance-in-temporalparticlestopathlines/17643/2 "2026-07-06T16:08:54Z")

</div>

> [@anahitanaj](#):
>
> **MaxStepDistance**

Here is the code:

```auto
  if (trail->length > 0)
  {
    unsigned int lastindex = (this->MaxTrackLength + trail->lastpoint - 1) % this->MaxTrackLength;
    double* lastcoord = trail->Coords[lastindex].x;
    //  
    double distx = fabs(lastcoord[0] - coord[0]);
    double disty = fabs(lastcoord[1] - coord[1]);
    double distz = fabs(lastcoord[2] - coord[2]);
    dist = sqrt(distx * distx + disty * disty + distz * distz);
    //  
    if (distx > this->MaxStepDistance[0] || disty > this->MaxStepDistance[1] ||
      distz > this->MaxStepDistance[2])
    {   
      trail->alive = false;
      trail->updated = true;
      return;
    }   
  }

```

It looks to me that if the dist is greater than max step distance, then the particle is killed.

Could you share data to reproduce ?
