//Add a Move in the track
 void AddMove(List<TimeStamp> move){
     TimeStamp tsCopy = new TimeStamp(0,0,0);
     for(int i = 0; i< move.Count; i++){
         tsCopy = tsCopy.DeepCopyTS(move[i]);
         tsCopy.timeSpawn += tmpTime;
         track.Add(tsCopy);
     }
     SetMaxSpawnTime();
     ComputeGlobalRate(); 
     numberMoves += 1;
 }
 //Init any type of node except LineNodes
 void InitAddNode(int moveIndex, List<TimeStamp> listTS, int joint, float speed, float scale, float holdEnd 
     , List<float> PosX, List<float> PosY, float offsetX, float offsetY, TimeStamp defaultNode)
 {
     for(int i =0; i < PosX.Count; i++){
         if (i==PosX.Count-1 && holdEnd != 0){
             TimeStamp tsHold = new TimeStamp(i/speed, 3, joint, defaultNode.timeToFinish, holdEnd, new Vector3(PosX[i]*scale + offsetX, PosY[i]*scale + offsetY,0));
             listTS.Add(tsHold);
         } else {
             TimeStamp ts = defaultNode.DeepCopyTS(defaultNode);
             ts.joint = joint;
             ts.timeSpawn = i/speed;
             ts.spawnPosition = new Vector3(PosX[i]*scale + offsetX, PosY[i]*scale + offsetY,0);
             if(defaultNode.nodeType == 2){
                 float previousX;
                 float previousY;
                 bool indexTooLow = false;
                 if(ts.joint == 0){
                     int indexR = indexPreviousPointR[i];
                     if (indexR < 2) {
                         indexTooLow = true;
                         indexR += 4;
                     }
                     previousX = (allMovementPos[moveIndex][0][indexR]+allMovementPos[moveIndex][0][indexR-1]+allMovementPos[moveIndex][0][indexR-2])/3*scale + offsetX;
                     previousY = (allMovementPos[moveIndex][1][indexR]+allMovementPos[moveIndex][1][indexR-1]+allMovementPos[moveIndex][1][indexR-2])/3*scale + offsetY;
                 } else {
                     int indexL = indexPreviousPointL[i];
                     if (indexL < 2) {
                         indexTooLow = true;
                         indexL += 4;
                     }
                     previousX = (allMovementPos[moveIndex][2][indexL]+allMovementPos[moveIndex][2][indexL-1]+allMovementPos[moveIndex][2][indexL-2])/3*scale + offsetX;
                     previousY = (allMovementPos[moveIndex][3][indexL]+allMovementPos[moveIndex][3][indexL-1]+allMovementPos[moveIndex][3][indexL-2])/3*scale + offsetY;
                 }
                 float deltaX = previousX - ts.spawnPosition.x;
                 float deltaY = previousY - ts.spawnPosition.y;
                 ts.startAngle = (float) (Math.Atan2(deltaY,deltaX) * 180/Math.PI);
                 if(indexTooLow) ts.startAngle -= 180;
             }
             listTS.Add(ts);
         }
     }
 }
 //Add a LineNode
 void InitAddLineNode(List<TimeStamp> listTS, int joint, float scale, float holdEnd
     , List<float> PosX, List<float> PosY, float offsetX, float offsetY, TimeStamp defaultNode)
 {
     TimeStamp ts = defaultNode.DeepCopyTS(defaultNode);
     ts.joint = joint;
     if (PosX.Count > 0){
         Vector3[] pathPositions = new Vector3[PosX.Count-1];
         for(int i = 0; i < PosX.Count; i++){
             if (i == 0){
                 ts.spawnPosition = new Vector3(PosX[i]*scale + offsetX,PosY[i]*scale + offsetY,0);
             } else pathPositions[i-1] = new Vector3(PosX[i]*scale + offsetX,PosY[i]*scale + offsetY,0);
         }
         ts.pathPositions = pathPositions;
         if (ts.spawnPosition.x < 80)
             listTS.Add(ts);
     }
     if (holdEnd != 0){
         TimeStamp tsHold = new TimeStamp(defaultNode.timeLine, 3, joint, defaultNode.timeToFinish, holdEnd, new Vector3(PosX[PosX.Count-1]*scale + offsetX, PosY[PosY.Count-1]*scale + offsetY,0));
         listTS.Add(tsHold);
     }
 }