Buggy code:
if ( manifoldDim == 2 ) { spatialSetTraj = new Gridded2DSet ( RealTupleType . SpatialCartesian2DTuple , new float [ ] [ ] { setLocs [ 0 ] , setLocs [ 1 ] } , lens [ 0 ] , lens [ 1 ] ) ; } else { spatialSetTraj = spatial_set0 ; } byte [ ] [ ] color_values = info . color_values ; int clrDim = color_values . length ; if ( ( info . trajColors ) != null ) color_values = info . trajColors ; Trajectory . markGrid = new boolean [ spatial_set0 . getLength ( ) ] ; Trajectory . markGridTime = new int [ spatial_set0 . getLength ( ) ] ; Arrays . fill ( Trajectory . markGrid , false ) ; Arrays . fill ( Trajectory . markGridTime , 0 ) ; byte [ ] [ ] startClrs = new byte [ color_values . length ] [ ] ; if ( ( startPts ) == null ) { startPts = new float [ 3 ] [ ] ; Trajectory . getStartPointsFromDomain ( trajSkip , spatial_set0 , color_values , startPts , startClrs ) ; } else { CoordinateSystem dspCoordSys = getLink ( ) . getRenderer ( ) . getDisplayCoordinateSystem ( ) ; float [ ] [ ] fltVals = new float [ startPts . length ] [ startPts [ 0 ] . length ] ; for ( int i = 0 ; i < ( fltVals . length ) ; i ++ ) System . arraycopy ( startPts [ i ] , 0 , fltVals [ i ] , 0 , fltVals [ i ] . length ) ; startPts = dspCoordSys . toReference ( fltVals ) ; int [ ] clrIdxs = null ; if ( manifoldDim == 2 ) { clrIdxs = spatialSetTraj . valueToIndex ( new float [ ] [ ] { startPts [ 0 ] , startPts [ 1 ] } ) ; } else { clrIdxs = spatialSetTraj . valueToIndex ( startPts ) ; } int num = clrIdxs . length ; startClrs [ 0 ] = new byte [ num ] ; startClrs [ 1 ] = new byte [ num ] ; startClrs [ 2 ] = new byte [ num ] ; if ( clrDim == 4 ) startClrs [ 3 ] = new byte [ num ] ; for ( int i = 0 ; i < num ; i ++ ) { int clrIdx = clrIdxs [ i ] ; startClrs [ 0 ] [ i ] = color_values [ 0 ] [ clrIdx ] ; startClrs [ 1 ] [ i ] = color_values [ 1 ] [ clrIdx ] ; startClrs [ 2 ] [ i ] = color_values [ 2 ] [ clrIdx ] ; if ( clrDim == 4 ) startClrs [ 3 ] [ i ] = color_values [ 3 ] [ clrIdx ] ; } } int numTrajectories = startPts [ 0 ] . length ; ArrayList < Trajectory > trajectories = new ArrayList < Trajectory > ( ) ; Interpolation uInterp = new Interpolation ( trajDoIntrp ) ; Interpolation vInterp = new Interpolation ( trajDoIntrp ) ; Interpolation wInterp = new Interpolation ( trajDoIntrp ) ; float [ ] [ ] values0 = null ; float [ ] [ ] values1 = null ; float [ ] [ ] values2 = null ; float [ ] [ ] values3 = null ; float [ ] [ ] values0_last = null ; double [ ] times = Trajectory . getTimes ( ( ( Gridded1DSet ) ( anim1DdomainSet ) ) ) ; double [ ] timeSteps = Trajectory . getTimeSteps ( ( ( Gridded1DSet ) ( anim1DdomainSet ) ) ) ; double timeAccum = 0 ; <START_BUG> for ( int k = 0 ; k < ( ( dataDomainLength ) - 1 ) ; k ++ ) { <END_BUG> int i = ( ( direction ) < 0 ) ? ( ( dataDomainLength ) - 1 ) - k : k ; info = Range . getAdaptedShadowType ( ) . getFlowInfo ( ) . get ( i ) ; color_values = info . color_values ; Gridded3DSet spatial_set = ( ( Gridded3DSet ) ( info . spatial_set ) ) ; manifoldDim = spatial_set . getManifoldDimension ( ) ; lens = spatial_set . getLengths ( ) ; setLocs = spatial_set . getSamples ( false ) ; if ( manifoldDim == 2 ) { spatialSetTraj = new Gridded2DSet ( RealTupleType . SpatialCartesian2DTuple , new float [ ] [ ] { setLocs [ 0 ] , setLocs [ 1 ] } , lens [ 0 ] , lens [ 1 ] ) ; } else { spatialSetTraj = spatial_set ; } float timeStep = ( ( float ) ( timeSteps [ i ] ) ) // ( numIntrpPts ) ; if ( ( k == 0 ) || ( timeAccum >= ( trajRefreshInterval ) ) ) { trajectories = new ArrayList < Trajectory > ( ) ; Arrays . fill ( Trajectory . markGrid , false ) ; if ( ( direction ) > 0 ) { switListen . allOffBelow . add ( i ) ; Trajectory . makeTrajectories ( ( ( direction ) * ( times [ i ] ) ) , trajectories , startPts , startClrs ) ; } else { } timeAccum = 0.0 ; } timeAccum += timeSteps [ i ] ; double x0 = ( ( double ) ( direction ) ) * i ; double x1 = ( ( double ) ( direction ) ) * ( i + ( ( direction ) * 1 ) ) ; double x2 = ( ( double ) ( direction ) ) * ( i + ( ( direction ) * 2 ) ) ; if ( ( k % 2 ) == 0 ) { FlowInfo flwInfo ; if ( values0 == null ) { flwInfo = flowInfoList . get ( i ) ;

Fix:
for ( int k = 0 ; k < ( dataDomainLength ) ; k ++ ) {