/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package visad;

/**
 *
 * @author rink
 */
public class Trajectory {
  
  /* The manager to which this trajectory belongs */
  TrajectoryManager trajMan;
  
  
  /* Current location (spatial set) of massless tracer particle */
  float[] startPts = new float[3];

  /* grid point neighbors and interp weights for current location */
  int[] startCell;
  float[] cellWeights;
  
  int[][] indices = new int[1][];
  float[][] weights = new float[1][];

  /* unit vector from last to current location*/
  float[] uVecPath = new float[] {Float.NaN, Float.NaN, Float.NaN};

  int[] guess3D = new int[] {-1,-1,-1};
  int[] guess2D = new int[] {-1,-1};

  byte[] startColor;
  byte[] stopColor;

  float[] stopPts = new float[3];
  float[][] startPts2D = new float[2][1];
  float[][] startPts3D = new float[3][1];
  
  /* first and current time and associated set indices */
  public int initialTimeIndex = 0;
  public int currentTimeIndex = 0;

  public double initialTime = 0;
  public double currentTime = 0;

  /* Flag indicating particle has moved out of the grid, or position 
     cannot be determined - Trajectory obj will be removed from list.
  */
  boolean offGrid = false;
  
  int clrDim;
  
  GriddedSet spatial_set;
  
  int manifoldDimension;

  int npairs = 0;
  int[] indexes = new int[60];
  
  float[] lastPtD = null;
  float[] lastPtC = null;
  float[] lastPtDD = null;
  float[] lastPtCC = null;
  
  float[][] circleXYZ;
  float[][] last_circleXYZ;  
  float[] lastTvec = new float[3];
  float[] lastSvec;
  
  static float[][] circle;
  
  public Trajectory(TrajectoryManager trajMan, float startX, float startY, float startZ, int[] startCell, float[] cellWeights, byte[] startColor, double initialTime) {
    startPts[0] = startX;
    startPts[1] = startY;
    startPts[2] = startZ;
    this.startCell = startCell;
    this.cellWeights = cellWeights;
    this.indices[0] = startCell;
    this.weights[0] = cellWeights;

    clrDim = startColor.length;
    stopColor = new byte[clrDim];

    this.startColor = startColor;   
    this.initialTime = initialTime;
    this.trajMan = trajMan;
  }
  
  public void forward(FlowInfo info, float[][] flow_values, byte[][] color_values, GriddedSet spatial_set, int direction, float timeStep)
           throws VisADException {
     
     if (offGrid) return;

     clrDim = color_values.length;
     float[] intrpClr = new float[clrDim];
     this.spatial_set = spatial_set;
     this.manifoldDimension = spatial_set.getManifoldDimension();


     float[][] flowLoc = new float[3][1];
     float[][] flowVec = new float[3][1];
     float[] intrpFlow = new float[3];

     if (indices[0] != null) {
        java.util.Arrays.fill(intrpFlow, 0f);
        java.util.Arrays.fill(intrpClr, 0);
        
        for (int j=0; j 

Ads help maintain this website.