generative modeling for Rhino
I found myself wanting to write sign(x) in an expression, and there doesn't seem to be an easy way to do it; I'm going to use a conditional instead.
Tags:
Permalink Reply by biboarchitect on June 21, 2012 at 11:53pm Sin(x) you mean?
Permalink Reply by Danny Boyes on June 22, 2012 at 2:40am I think it refers to the SIGN transfer function of Fortran days.
Where you could specify two variables Sign(x,y) which would change the sign of x if y was different.
eg
sign(1,2) = 1
sign(1,-2) = -1
sign(-1,2) = 1
sign(-1,-2) = -1
Permalink Reply by Danny Boyes on June 22, 2012 at 3:13am
Permalink Reply by Randolph Fritz on June 22, 2012 at 11:24am Thanks.
Permalink Reply by Randolph Fritz on June 22, 2012 at 11:28am I was thinking more of the more modern sign() function, where:
-1 if x < 0
sign(x) = 0 if x = 0
1 if x > 0
This can be used as a sign transfer function by multiplication:
sign(x) * whatever
I ended up writing something like "if(x>0,1,-1)", which worked, but isn't very elegant.
Permalink Reply by Randolph Fritz on July 9, 2012 at 12:43pm A very late note in this thread; this is called the "signum" function, usually denoted "sgn," though some computer languages make it "sign." See http://mathworld.wolfram.com/Sign.html. I still wish Grasshopper included it.
© 2013 Created by Scott Davidson.
Powered by