← Back to team overview

yade-users team mailing list archive

Re: [Question #294531]: Change colour of spheres when based on Movement

 

Question #294531 on Yade changed:
https://answers.launchpad.net/yade/+question/294531

    Status: Open => Answered

Jan Stránský proposed the following answer:
>
>
> I've managed to get the colors changing, but the s.state.displ().norm()
> function seems to have a value even before that part of the code has
> been run (perhaps stored previosu displacements?
>
> Is there a way to reset that value?


state.displ() is computed internally as state.pos - state.refPos, so the
displacement from the "original position".

state.refPos may be set manually to arbitrary value, you can try something
like b.state.refPos = b.state.pos. You can do this regularly to color the
particles according to "displacement increment" from previous color change.
This way is quite flexible, so depending on your needs you can use
different approaches.

cheers
Jan

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.