|
|
"Kenneth" <kdw### [at] gmailcom> wrote:
> Still, your example is an interesting one--
> I've never used an #if() block *as* an Rvalue. (Hmm, what happens to #local A if
> the #if is 'false'?)
Indeed. There are lots of interesting things one can do within SDL that I would
have never thought to attempt - instinctually dismissing them as invalid. I'm
sure there are some I haven't seen and no one's tried yet.
I just came across this neat little trick using conditionals that has the same
"I didn't know you could write things that way!" flavor:
http://www.econym.demon.co.uk/isotut/splines.htm
(at bottom of page)
"This is achieved by mutiplying one x spline function by (v<=pi) and the other
by (v>pi). The comparison operators return 0 for false and 1 for true, so the
sum switches from being one spline to the other when v becomes pi.
Similarly the z spline functions are multiplied by (cos(v)<=0) and (cos(v)>0),
which switch when v=pi/2 and switch back when v=3*pi/2."
Just thought I'd share while it was on my mind.
I need to try it with something like (cos(v)>=pi/2) | (cos(v)<pi)
to see if I can only invoke a certain range.
I was trying to noodle it out using select - but that seemed quite hard to
figure out how to specify a range.
Ooooh - unless I use the conditional as the first parameter.... <lightbulb>
Post a reply to this message
|
|