We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › getting color from Velocity (or getting float)
Page Index Toggle Pages: 1
getting color from Velocity (or getting float?) (Read 727 times)
getting color from Velocity (or getting float?)
Sep 13th, 2009, 1:57pm
 
Hello,
I have some question marks in my mind so i am going to wait for your precious helps, thanks for your time already.

So i got this particle class, and in display function there is point();
and some PVectors such as vel, loc, acc.

What i want to do is, making my particles a little red and white according to their Velocity. (when they move at >= specific speed) Though, since it is PVector i cannot get a float value from it, and i am stuck, don't know what to do in stroke(   );

Any suggestions to convert them to float, or get their value somehow?

Thank you,
metin
Re: getting color from Velocity (or getting float?)
Reply #1 - Sep 13th, 2009, 2:41pm
 
you can use vel.x vel.y vel.z to get what is stored in the PVector, in this case velocity in the different directions.

you can also temp store them in an array using http://processing.org/reference/PVector_array_.html
Re: getting color from Velocity (or getting float?)
Reply #2 - Sep 13th, 2009, 4:25pm
 
Cedric, i've made it thanks to you
Page Index Toggle Pages: 1