Hi everyones!
I’m trying to make a sort of ‘follow mode’ of a point rotating . One point follows the point rotating and an other point follows the point following the rotating point. I would like that thoses points n+1 follows point with phase and time offset.In others worls i want that a point follow point who is just next to him. Not all points follow the first point rotating.
Here a explanation https://youtu.be/WbysR8RA4Ko
Here, one possible use of my project https://youtu.be/a6RVfLpc1QA
My program is on the end of this message
The goal is that a point 2 that rotates from position 0 to 6400 “gives” its position to another point 3
He gives him his position with a time lag.
I managed to do it, but only with points 2 and 3.
Then you have to generalize to point 2 to 12, but my function shifts all the points at the same time, without waiting 200 ms for example. I would like, when point 3 passes in front of 4 by 200 points, point 4 waits 200 ms before moving forward 200 points in turn. And so on until the last point 12.
I really think you can find the answer quite easily so I am sending you my program.
I have pre-recorded different settings.
At the bottom of the screen :
K phi=0 means 0 phase shift. K phi=1 ==> 200 shift points
D ratio =75 means 75 ms of phase shift.
Realign the points up with ç
Increase phase shift with left arrow
Increase time offset with right arrow
Put point 2 at speed 2 with A
Divide the frequency by 2 with n
Multiply the frequency by 2 with N
If the function stops, it is restarted with the o key
To no longer have the pre-recordings, you must choose an empty file, which is under the empty file comment.
Tell if it is a ‘have to pay job’
Thanksss
Here the fonction
if (circularMov==true ){ print ("Beginning circularMov "); println (circularMov);
if (d>=0){
timeOffset=d; // timeOffset in millis (50,.. 1000 ms), before changing phase i+1 with the phase from i
}
if (k>=0){
phiShift=k*PI/16; // here the position to add or substrat to the next point (i+1)
mapShiftCircular= map (phiShift, 0, 64*PI/16, 0, 6400); // one revolution is 6400 step
// mapShiftCircular is the space to reach in order to follow the previous point
}
formerEvent[0]=millis(); // time from the beginning of the launch of the program.
print (" timeOffset "); print (timeOffset); print (" mapShiftCircular "); print (mapShiftCircular);
for (int j = 2; j < (3); j++) {
if ( circularMov==true && //( // circularMov==true
((CircularOldVirtualPosition[j] <= CircularOldVirtualPosition[j+1]+mapShiftCircular) && (CircularVirtualPosition[j] >= CircularVirtualPosition[j+1]+mapShiftCircular) &&
(CircularOldVirtualPosition[j] < CircularVirtualPosition[j]))// space CW
)
{ print (" CircularOldVirtualPosition i ") ; print (j); print (" ") ; print (CircularOldVirtualPosition[j]) ;
print (" CircularVirtualPosition[i ") ; print (j); print (" ") ; println (CircularVirtualPosition[j]) ;
print ("point "); print (j); print ("is ready to give its position to point"); print (j+1); println (" TRIGGED with PHASE OFFSET*******************") ;
print ("Before net.phase[j+1]= "); print (j+1); print (" "); println (net.phase[j+1]);
print ("actual time is formerEvent[0] ") ; print (0); print (" ") ; println (formerEvent[0]) ; // println();
print ("before timer ") ; print (j); print (" ") ; println (formerEvent[j]) ; // println();
followNumber[j]= true;
formerEvent[j]=formerEvent[0]; // set formerEvent[j] to actual time
interphase[j]=net.phase[j];
}
if ( formerEvent[0]>=formerEvent[j]+timeOffset && followNumber[j]== true//&& (CircularOldVirtualPosition[j]<= CircularVirtualPosition[j])
){
print ("point "); print (j); print (" gave its position to point"); print (j+1); println (" TRIGGED with TIME AND PHASE OFFSET*******************") ;
print ("timer elapsed between timeoffset and phase offset in Clock Wise Way ") ;
print (j); print (" ") ; println (formerEvent[0]- formerEvent[j]) ; // println();
net.phase[j+1]=interphase[j]-phiShift*0;//
net.phase[j+1]= net.phase[j+1]%(TWO_PI*1);// keep phase between 0 and TWO_PI
print ("After net.phase[j+1]= "); print (j+1); print (" ") ;println (net.phase[j+1]);
print (" followNumber after time offsett "); print (j); print (" "); println (followNumber[j]);
followNumber[j]= false;
memoryi=j;
}
// TRICK TO NO BEEN BLOCKED DUE TO THE BUG when point pass trough 0
if ( formerEvent[0]>=formerEvent[j]+timeOffset && (CircularOldVirtualPosition[j]> CircularVirtualPosition[j]) // && followNumber[j]== true//&& (CircularOldVirtualPosition[j]<= CircularVirtualPosition[j])
){
print (" memoryiCircular= "); print (memoryi); println ("***********************TIME AFTER TIME OFFSET CW PASSING THROUG 0") ;
print ("CW After time offsett formerEvent[j] ") ; print (j); print (" ") ; println (formerEvent[j]) ; // println();
print ("After time offsett net.phase[j+1]= "); print (j+1); print (" ") ;println (net.phase[j+1]);
// net.phase[j+1]=interphase[j]-net.phase[j]-phiShift*0;//
//NO net.phase[j+1]=interphase[j]+net.phase[j]-phiShift*0;//
net.phase[j+1]= net.phase [j]+phiShift*0;//
// net.phase[j+1]= interphase[j]-phiShift*0;//
net.phase[j+1]= net.phase[j+1]%(TWO_PI*1);// keep phase between 0 and TWO_PI
followNumber[j]= false;
memoryi=j;
// formerEvent[j]=formerEvent[0];
}
// end 2 3
}
for (int j = 3; j < (4); j++) {
if ( circularMov==true && //( // circularMov==true
((CircularOldVirtualPosition[j] <= CircularOldVirtualPosition[j+1]+mapShiftCircular) && (CircularVirtualPosition[j] >= CircularVirtualPosition[j+1]+mapShiftCircular) &&
(CircularOldVirtualPosition[j] < CircularVirtualPosition[j]))// space CW
)
{ print (" CircularOldVirtualPosition ") ; print (j); print (" ") ; print (CircularOldVirtualPosition[j]) ;
print (" CircularVirtualPosition ") ; print (j); print (" ") ; println (CircularVirtualPosition[j]) ;
print ("point "); print (j); print ("is ready to give its position to point"); print (j+1); println (" TRIGGED with PHASE OFFSET*******************") ;
print ("Before net.phase[j+1]= "); print (j+1); print (" "); println (net.phase[j+1]);
print ("actual time is formerEvent[0] ") ; print (0); print (" ") ; println (formerEvent[0]) ; // println();
print ("before timer ") ; print (j); print (" ") ; println (formerEvent[j]) ; // println();
followNumber[j]= true;
formerEvent[j]=formerEvent[0]; // set formerEvent[j] to actual time
interphase[j]=net.phase[j];
}
if ( formerEvent[0]>=formerEvent[j]+timeOffset // && followNumber[j]== true//&& (CircularOldVirtualPosition[j]<= CircularVirtualPosition[j])
){
print ("point "); print (j); print (" gave its position to point"); print (j+1); println (" TRIGGED with TIME AND PHASE OFFSET*******************") ;
print ("timer elapsed between timeoffset and phase offset in Clock Wise Way ") ;
print (j); print (" ") ; println (formerEvent[0]- formerEvent[j]) ; // println();
net.phase[j+1]=interphase[j]-phiShift*0;//
net.phase[j+1]= net.phase[j+1]%(TWO_PI*1);// keep phase between 0 and TWO_PI
print ("After net.phase[j+1]= "); print (j+1); print (" ") ;println (net.phase[j+1]);
print (" After time offsett, the phase offseet between "); print (j); print (" and "); print (j+1); print (" is "); println (followNumber[j]);
followNumber[j]= false;
memoryi=j;
}
// TRICK TO NO BEEN BLOCKED DUE TO THE BUG zhen point pass trough 0
if ( formerEvent[0]>=formerEvent[j]+timeOffset && (CircularOldVirtualPosition[j]> CircularVirtualPosition[j]) // && followNumber[j]== true//&& (CircularOldVirtualPosition[j]<= CircularVirtualPosition[j])
){
print (" memoryiCircular= "); print (memoryi); println ("***********************TIME AFTER TIME OFFSET CW PASSING THROUG 0") ;
print ("CW After time offsett formerEvent[j] ") ; print (j); print (" ") ; println (formerEvent[j]) ; // println();
print ("After time offsett net.phase[j+1]= "); print (j+1); print (" ") ;println (net.phase[j+1]);
// net.phase[j+1]=interphase[j]-net.phase[j]-phiShift*0;//
//NO net.phase[j+1]=interphase[j]+net.phase[j]-phiShift*0;//
net.phase[j+1]= net.phase [j]+phiShift*0;//
// net.phase[j+1]= interphase[j]-phiShift*0;//
net.phase[j+1]= net.phase[j+1]%(TWO_PI*1);// keep phase between 0 and TWO_PI
followNumber[j]= false;
memoryi=j;
// formerEvent[j]=formerEvent[0];
}
// end 3 4
}
Here the link to download my program
https://we.tl/t-YSrAYwOZoe