← Back to team overview

yade-users team mailing list archive

Re: [Question #691702]: About periodic simple shear example in the yade documentation

 

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

    Status: Open => Answered

Jan Stránský proposed the following answer:
> 1. Why it add"!" behind the "stress[2,2]"? (If it means factorial,
non-negative factorial is greater than or equal to one)

"!=" is Python operator for inequality [2]
stress[2,2]!=0
means stress[2,2] is not equal to zero. Compare to
stress[2,2]==0
which means stress[2,2] is zero

> 2  ... b.shape.color=scalarOnColorScale(b.state.rot().norm(),0,pi/2.))
means the color of the variable will change according to the value of
the variable compared to 0 and pi/2.

yes, the color of body 'b' will change according to the value of
b.state.rot().norm() relative to the color scale from 0 to pi/2

> 2 ... But I can't relate it to the specification

yade._utils.scalarOnColorScale((float)x[, (float)xmin=0[,
(float)xmax=1]]) → Vector3

components:
(float)x ... first parameter, named x (which is not much important), of type float (real number)
[ ... means optional argument
(float)xmin=0 ... second parameter, named xmin, of type float, with default value 0 (if you do not specify it)
[ ... another optional argument
(float)xmax=1 ... third parameter, named xmax, of type float, with default value 1 (if you do not specify it)
→ Vector3 ... the function returns Vector3 instance

In this specific example:
x = b.state.rot().norm()
xmin = 0
xmax = pi/2

cheers
Jan

[2] https://docs.python.org/3/library/stdtypes.html#comparisons

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