← Back to team overview

yade-users team mailing list archive

Re: [Question #701637]: Why are some particles white

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
Instant replay:
please provide a MWE [1] - a complete code which we can try.

> I generated a sample ... used some methods ...

please be (much) more specific.
Ideally provide a MWE [1]

> Is this the reason why the particles are white?

Maybe yes, maybe no, we can only guess without a MWE [1]

> and set different colors for each force chain, excluding white, but
finally many particles are displayed in white.

Isn't it the case that you simply color the particles white yourself?
shape.color [2] is a **normalized** form, i.e. values in range 0-1.
Trying your code, I simply get most of particles white (just because most of the values are > 1)
###
import numpy as np
RGB_array = np.array([[47,79,79],[105,105,105],[112,128,144],[0,0,128],[100,149,237],[72,61,139],[0,191,255],[0,100,0],[85,107,47],[255,255,0],[205,92,92],[139,69,19],[255,0,0],[255,20,147],[160,32,240],[255,165,0],[205,133,63],[244,164,96],[192,255,62]])
for i in range(100):
    ran = random.randint(0,18)
    color = (RGB_array[ran,0],RGB_array[ran,1],RGB_array[ran,2])
    color = [float(v) for v in color]
    O.bodies.append(sphere((i,0,0),0.5,color=color))
###

Are you aware of randomColor standard Yade function [3]?

Cheers
Jan

[2] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Shape.color
[3] https://yade-dem.org/doc/yade.utils.html#yade.utils.randomColor

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