Forums > MaxMSP

Keep Constant Speed for different distances to Line.


Sym
November 23, 2013 | 2:13 pm

Hey, I’m currently working on a graphics patch and stuck at this part.

I have different distance I’m sending to line.
For example from 0 to 1000 and from 0 to 10.

Now if I send both with the same duration to line the numbers will move more rapidly at the higher range as it is a longer distance.

Has anybody an idea how I could calculate the duration to send to line so the velocity is staying constant?


November 23, 2013 | 5:30 pm

I have a patch for you, lemme real quick upgrade my max, since the latest osx crashes 6.1.4 constantly, hehe.


November 23, 2013 | 5:32 pm

speed is defined as distance per unit time, so duration (the unit time bit) will be distance divided by speed:

<code>

– Pasted Max Patch, click to expand. –

</code>


November 23, 2013 | 5:58 pm

<code>

– Pasted Max Patch, click to expand. –

</code>


November 23, 2013 | 6:05 pm

ah, nice to see a different take on it. FPs is simpler, and I guess uses proper "units" (no idea if mine does, coincidentally, it probably does?), whereas mine is situationally aware in a sense.



Sym
November 24, 2013 | 1:52 am

Thanks Wetterberg and Floating Point for providing your thoughts on this.
Two great solutions and both work perfectly for my purpose!



Sym
November 24, 2013 | 4:41 am

Hey, I ran into another problem in trying to adapt the patch to my needs.

I’m using the constant line velocity to make points move to different positions in a 2D Space. For this I interpolate one X/Y to the next X/Y values via two line objects.

The constant velocity works great but now I realized that I need to calculate different speeds for the X and the Y Movement so that X1,Y1 arrive at the same point in time at X2,Y2.

For Example if X1 to X2 is 20 distance and Y1 to Y2 is 10 distance the speed of X would have to be twice the speed of Y.

Does anybody have an idea how to adapt the pacthes above for that problem? It’s completely twisting my mind..



Sym
November 24, 2013 | 4:42 am

Hey, I ran into another problem in trying to adapt the patch to my needs.

I’m using the constant line velocity to make points move to different positions in a 2D Space. For this I interpolate one X/Y to the next X/Y values via two line objects.

The constant velocity works great but now I realized that I need to calculate different speeds for the X and the Y Movement so that X1,Y1 arrive at the same point in time at X2,Y2.

For Example if X1 to X2 is 20 distance and Y1 to Y2 is 10 distance the speed of X would have to be twice the speed of Y.

Does anybody have an idea how to adapt the pacthes above for that problem? It’s completely twisting my mind..


Viewing 8 posts - 1 through 8 (of 8 total)